Class: Rlocu::GeoJSON

Inherits:
Object
  • Object
show all
Defined in:
lib/rlocu/geo_json.rb

Instance Method Summary collapse

Constructor Details

#initialize(geo) ⇒ GeoJSON

Returns a new instance of GeoJSON.

Raises:

  • (ArgumentError)


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

#latitudeObject



14
15
16
# File 'lib/rlocu/geo_json.rb', line 14

def latitude
  coordinates[1]
end

#longitudeObject



10
11
12
# File 'lib/rlocu/geo_json.rb', line 10

def longitude
  coordinates[0]
end