Class: ESS::Validation::TextIsValidLongitude

Inherits:
Object
  • Object
show all
Defined in:
lib/ess/validation.rb

Instance Method Summary collapse

Instance Method Details

#validate(tag) ⇒ Object



98
99
100
101
102
# File 'lib/ess/validation.rb', line 98

def validate tag
  unless tag.text! =~ /^-?((1?[0-7]?|[0-9]?)[0-9]|180)\.[0-9]{1,6}$/
    raise ValidationError, "invalid longitude: #{tag.text!}"
  end
end