Class: ActiveInteraction::ArrayInput
- Defined in:
- lib/active_interaction/array_input.rb
Overview
Represents a processed array input.
Instance Attribute Summary collapse
-
#children ⇒ Array<Input, ArrayInput, HashInput>
readonly
Child inputs if a nested filter is used.
Attributes inherited from Input
Instance Method Summary collapse
-
#errors ⇒ Filter::Error
Any errors that occurred during processing.
Instance Attribute Details
#children ⇒ Array<Input, ArrayInput, HashInput> (readonly)
19 20 21 |
# File 'lib/active_interaction/array_input.rb', line 19 def children @children end |
Instance Method Details
#errors ⇒ Filter::Error
Any errors that occurred during processing.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active_interaction/array_input.rb', line 24 def errors return @errors if defined?(@errors) return @errors = super if @error child_errors = get_errors_by_index(children) return @errors = super if child_errors.empty? @errors ||= if @index_errors child_errors.map do |(error, i)| name = attach_child_name(:"#{@filter.name}[#{i}]", error) Filter::Error.new(error.filter, error.type, name: name) end.freeze else error, = child_errors.first [Filter::Error.new(@filter, error.type)].freeze end end |