Class: Geocoder::Result::Base
- Inherits:
-
Object
- Object
- Geocoder::Result::Base
- Defined in:
- lib/geocoder/results/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#address(format = :full) ⇒ Object
A string in the given format.
-
#coordinates ⇒ Object
A two-element array: [lat, lon].
- #country ⇒ Object
- #country_code ⇒ Object
-
#initialize(data) ⇒ Base
constructor
Takes a hash of result data from a parsed Google result document.
- #latitude ⇒ Object
- #longitude ⇒ Object
Constructor Details
#initialize(data) ⇒ Base
Takes a hash of result data from a parsed Google result document.
9 10 11 |
# File 'lib/geocoder/results/base.rb', line 9 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/geocoder/results/base.rb', line 4 def data @data end |
Instance Method Details
#address(format = :full) ⇒ Object
A string in the given format.
16 17 18 |
# File 'lib/geocoder/results/base.rb', line 16 def address(format = :full) fail end |
#coordinates ⇒ Object
A two-element array: [lat, lon].
23 24 25 |
# File 'lib/geocoder/results/base.rb', line 23 def coordinates [@data['latitude'].to_f, @data['longitude'].to_f] end |
#country ⇒ Object
35 36 37 |
# File 'lib/geocoder/results/base.rb', line 35 def country fail end |
#country_code ⇒ Object
39 40 41 |
# File 'lib/geocoder/results/base.rb', line 39 def country_code fail end |
#latitude ⇒ Object
27 28 29 |
# File 'lib/geocoder/results/base.rb', line 27 def latitude coordinates[0] end |
#longitude ⇒ Object
31 32 33 |
# File 'lib/geocoder/results/base.rb', line 31 def longitude coordinates[1] end |