Sha256: 063348763096d28f09df98f7c622efd16208ff2001a73788956d26da706bbfbc
Contents?: true
Size: 1.14 KB
Versions: 26
Compression:
Stored size: 1.14 KB
Contents
module Foobara module BuiltinTypes module Array module SupportedProcessors class ElementTypeDeclaration < TypeDeclarations::ElementProcessor def element_type @element_type ||= type_for_declaration(element_type_declaration) end def process_value(array) errors = [] array.each.with_index do |element, index| element_outcome = element_type.process_value(element) if element_outcome.success? array[index] = element_outcome.result else element_outcome.each_error do |error| error.prepend_path!(index) errors << error end end end Outcome.new(result: array, errors:) end def possible_errors super + element_type.possible_errors.map do |possible_error| possible_error = possible_error.dup possible_error.prepend_path!(:"#") possible_error end end end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems