Class: Dry::Validation::ApplyChecks

Inherits:
ApplyRules show all
Defined in:
lib/dry/validation/executor.rb

Instance Attribute Summary

Attributes inherited from ApplyRules

#rules

Instance Method Summary collapse

Methods inherited from ApplyRules

#initialize

Constructor Details

This class inherits a constructor from Dry::Validation::ApplyRules

Instance Method Details

#call(input, result) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/dry/validation/executor.rb', line 45

def call(input, result)
  rules.each_with_object(result) do |(name, check), hash|
    check_res = check.is_a?(Guard) ? check.(input, result) : check.(input)
    hash[name] = check_res if check_res
  end
  input
end