Class: Cora::Location

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cora/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(latitude, longitude, extra = {}) ⇒ Location

Returns a new instance of Location.



11
12
13
14
15
# File 'lib/cora/location.rb', line 11

def initialize(latitude, longitude, extra = {})
  @latitude = latitude
  @longitude = longitude
  @extra = extra
end

Instance Attribute Details

#extraObject (readonly)

Returns the value of attribute extra.



9
10
11
# File 'lib/cora/location.rb', line 9

def extra
  @extra
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



9
10
11
# File 'lib/cora/location.rb', line 9

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



9
10
11
# File 'lib/cora/location.rb', line 9

def longitude
  @longitude
end

Instance Method Details

#resultObject

Returns nil if geolocation failed, or an instance of Geocoder::Result::Google See: rubydoc.info/github/alexreisner/geocoder/master/Geocoder/Result/Google



19
20
21
# File 'lib/cora/location.rb', line 19

def result
  results.first
end

#resultsObject

Returns an array of objects of class Geocoder::Result::Google (probably)



24
25
26
# File 'lib/cora/location.rb', line 24

def results
  @results ||= perform_reverse_geocode
end