Class: Valigator::CSV::FieldValidators::Integer
- Inherits:
-
Base
- Object
- Base
- Valigator::CSV::FieldValidators::Integer
show all
- Defined in:
- lib/valigator/csv/field_validators/integer.rb
Direct Known Subclasses
Float
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#==, #initialize
Instance Method Details
#error_message ⇒ Object
20
21
22
|
# File 'lib/valigator/csv/field_validators/integer.rb', line 20
def error_message
'Invalid integer field'
end
|
#error_type ⇒ Object
14
15
16
|
# File 'lib/valigator/csv/field_validators/integer.rb', line 14
def error_type
'invalid_integer'
end
|
#valid?(value) ⇒ Boolean
6
7
8
9
10
|
# File 'lib/valigator/csv/field_validators/integer.rb', line 6
def valid?(value)
return true if allow_blank and blank? value
value.is_a?(::Integer) || value.to_i.to_s == value.to_s
end
|