Class: Veto::MinLengthCheck
- Inherits:
-
AttributeCheck
- Object
- Check
- AttributeCheck
- Veto::MinLengthCheck
- Defined in:
- lib/veto/checks/min_length_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 |
# File 'lib/veto/checks/min_length_check.rb', line 3 def check(attribute, value, errors, ={}) min = .fetch(:with) = .fetch(:message, :min_length) on = .fetch(:on, attribute) if value.nil? || value.length < min errors.add(on, , min) end end |