Class: Rlocu::GeoJSON
- Inherits:
-
Object
- Object
- Rlocu::GeoJSON
- Defined in:
- lib/rlocu/geo_json.rb
Instance Method Summary collapse
-
#initialize(geo) ⇒ GeoJSON
constructor
A new instance of GeoJSON.
- #latitude ⇒ Object
- #longitude ⇒ Object
Constructor Details
#initialize(geo) ⇒ GeoJSON
Returns a new instance of GeoJSON.
3 4 5 6 7 8 |
# File 'lib/rlocu/geo_json.rb', line 3 def initialize(geo) raise ArgumentError unless geo['type'] raise ArgumentError unless geo['coordinates'] @point = geo['type'] @coordinates = geo['coordinates'] end |
Instance Method Details
#latitude ⇒ Object
14 15 16 |
# File 'lib/rlocu/geo_json.rb', line 14 def latitude coordinates[1] end |
#longitude ⇒ Object
10 11 12 |
# File 'lib/rlocu/geo_json.rb', line 10 def longitude coordinates[0] end |