Class: Barometer::Query::Format::Coordinates
- Defined in:
- lib/barometer/query/formats/coordinates.rb
Overview
eg. 123.1234,-123.123
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.geo(query) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/barometer/query/formats/coordinates.rb', line 10 def self.geo(query) return unless query coordinates = query.split(',') {latitude: coordinates[0].to_f, longitude: coordinates[1].to_f} end |
.regex ⇒ Object
8 |
# File 'lib/barometer/query/formats/coordinates.rb', line 8 def self.regex; /^[-]?[0-9\.]+[,]{1}\s?[-]?[0-9\.]+$/; end |