Class: Veto::IntegerValidator
- Inherits:
-
AttributeValidator
- Object
- AbstractValidator
- AttributeValidator
- Veto::IntegerValidator
- Defined in:
- lib/veto/validators/integer_validator.rb
Instance Method Summary collapse
Methods inherited from AttributeValidator
Methods inherited from AbstractValidator
Constructor Details
This class inherits a constructor from Veto::AttributeValidator
Instance Method Details
#validate(entity, attribute, value, errors, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/veto/validators/integer_validator.rb', line 5 def validate entity, attribute, value, errors, ={} = .fetch(:message, :integer) on = .fetch(:on, attribute) begin Kernel.Integer(value.to_s) nil rescue errors.add(on, ) end end |