Class: Veto::LessThanCheck
- Inherits:
-
AttributeCheck
- Object
- Check
- AttributeCheck
- Veto::LessThanCheck
- Defined in:
- lib/veto/checks/less_than_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 13 14 15 16 17 18 |
# File 'lib/veto/checks/less_than_check.rb', line 3 def check(attribute, value, errors, ={}) boundary = .fetch(:with) = .fetch(:message, :less_than) on = .fetch(:on, attribute) begin v = Kernel.Float(value.to_s) nil rescue return errors.add(on, , boundary) end unless v < boundary errors.add(on, , boundary) end end |