Class: Dry::Validation::ApplyRules
- Inherits:
-
Object
- Object
- Dry::Validation::ApplyRules
- Defined in:
- lib/dry/validation/executor.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #call(input, result) ⇒ Object
-
#initialize(rules) ⇒ ApplyRules
constructor
A new instance of ApplyRules.
Constructor Details
#initialize(rules) ⇒ ApplyRules
Returns a new instance of ApplyRules.
32 33 34 |
# File 'lib/dry/validation/executor.rb', line 32 def initialize(rules) @rules = rules end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
30 31 32 |
# File 'lib/dry/validation/executor.rb', line 30 def rules @rules end |
Instance Method Details
#call(input, result) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/dry/validation/executor.rb', line 36 def call(input, result) rules.each_with_object(result) do |(name, rule), hash| hash[name] = rule.(input) end input end |