Class: Dry::Schema::RuleApplier Private
- Inherits:
-
Object
- Object
- Dry::Schema::RuleApplier
- Extended by:
- Initializer
- Defined in:
- lib/dry/schema/rule_applier.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Applies rules defined within the DSL
Instance Method Summary collapse
- #call(input) ⇒ Object private
- #to_ast ⇒ Object private
Instance Method Details
#call(input) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dry/schema/rule_applier.rb', line 24 def call(input) results = EMPTY_ARRAY.dup rules.each do |name, rule| next if input.error?(name) result = rule.(input.to_h) results << result if result.failure? end input.concat(results) end |
#to_ast ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 42 43 44 |
# File 'lib/dry/schema/rule_applier.rb', line 38 def to_ast if config..namespace [:namespace, [config..namespace, [:set, rules.values.map(&:to_ast)]]] else [:set, rules.values.map(&:to_ast)] end end |