Class: ActiveInteraction::HashInput
- Defined in:
- lib/active_interaction/hash_input.rb
Overview
Represents a processed hash input.
Instance Attribute Summary collapse
-
#children ⇒ Hash{ Symbol => Input, ArrayInput, HashInput }
readonly
Child inputs if nested filters are used.
Attributes inherited from Input
Instance Method Summary collapse
-
#errors ⇒ Filter::Error
Any errors that occurred during processing.
-
#initialize(filter, value: nil, error: nil, children: {}) ⇒ HashInput
constructor
A new instance of HashInput.
Constructor Details
#initialize(filter, value: nil, error: nil, children: {}) ⇒ HashInput
Returns a new instance of HashInput.
7 8 9 10 11 |
# File 'lib/active_interaction/hash_input.rb', line 7 def initialize(filter, value: nil, error: nil, children: {}) super(filter, value: value, error: error) @children = children end |
Instance Attribute Details
#children ⇒ Hash{ Symbol => Input, ArrayInput, HashInput } (readonly)
17 18 19 |
# File 'lib/active_interaction/hash_input.rb', line 17 def children @children end |
Instance Method Details
#errors ⇒ Filter::Error
Any errors that occurred during processing.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/active_interaction/hash_input.rb', line 22 def errors return @errors if defined?(@errors) return @errors = super if @error child_errors = get_errors(children) return @errors = super if child_errors.empty? @errors ||= child_errors.map do |error| Filter::Error.new(error.filter, error.type, name: :"#{@filter.name}.#{error.name}") end.freeze end |