Class: Veto::InclusionCheck
- Inherits:
-
AttributeCheck
- Object
- Check
- AttributeCheck
- Veto::InclusionCheck
- Defined in:
- lib/veto/checks/inclusion_check.rb
Instance Method Summary collapse
Methods inherited from AttributeCheck
Methods inherited from Check
Constructor Details
This class inherits a constructor from Veto::AttributeCheck
Instance Method Details
#check(attribute, value, errors, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/veto/checks/inclusion_check.rb', line 3 def check(attribute, value, errors, ={}) set = .fetch(:in) inclusion_method = set.respond_to?(:cover?) ? :cover? : :include? = .fetch(:message, :inclusion) on = .fetch(:on, attribute) unless set.send(inclusion_method, value) errors.add(on, , set) end end |