Class: Validation::Rule::Latitude
- Inherits:
-
Object
- Object
- Validation::Rule::Latitude
- Defined in:
- lib/validation/rule/latitude.rb
Instance Method Summary collapse
Instance Method Details
#error_key ⇒ Object
5 6 7 |
# File 'lib/validation/rule/latitude.rb', line 5 def error_key :latitude end |
#params ⇒ Object
16 17 18 |
# File 'lib/validation/rule/latitude.rb', line 16 def params {} 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 |