Class: Valigator::CSV::FieldValidators::Float

Inherits:
Integer
  • Object
show all
Defined in:
lib/valigator/csv/field_validators/float.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#==, #initialize

Constructor Details

This class inherits a constructor from Valigator::CSV::FieldValidators::Base

Instance Method Details

#error_messageObject



18
19
20
# File 'lib/valigator/csv/field_validators/float.rb', line 18

def error_message
  'Invalid float field'
end

#error_typeObject



12
13
14
# File 'lib/valigator/csv/field_validators/float.rb', line 12

def error_type
  'invalid_float'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/valigator/csv/field_validators/float.rb', line 6

def valid?(value)
  super || value.is_a?(::Float) || formatted_float?(value)
end