Class: Validation::Rule::Latitude
- Inherits:
-
StretchyRule
- Object
- StretchyRule
- Validation::Rule::Latitude
- Defined in:
- lib/validation/rule/latitude.rb
Instance Method Summary collapse
Methods inherited from StretchyRule
#empty_ok?, #initialize, #invalid_empty?, #is_empty?, #params, #required?
Constructor Details
This class inherits a constructor from Validation::Rule::StretchyRule
Instance Method Details
#error_key ⇒ Object
5 6 7 |
# File 'lib/validation/rule/latitude.rb', line 5 def error_key :latitude end |
#valid_value?(value) ⇒ Boolean
9 10 11 12 13 14 |
# File 'lib/validation/rule/latitude.rb', line 9 def valid_value?(value) valid = true value = Float(value) rescue nil valid = false unless value && value.to_f <= 90 && value.to_f >= -90 valid end |