Class: Geocoder::Result::Base
- Inherits:
-
Object
- Object
- Geocoder::Result::Base
show all
- Defined in:
- lib/geocoder/results/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Base
Takes a hash of result data from a parsed Google result document.
9
10
11
12
|
# File 'lib/geocoder/results/base.rb', line 9
def initialize(data)
@data = data
@cache_hit = nil
end
|
Instance Attribute Details
#cache_hit ⇒ Object
Returns the value of attribute cache_hit.
4
5
6
|
# File 'lib/geocoder/results/base.rb', line 4
def cache_hit
@cache_hit
end
|
#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.
17
18
19
|
# File 'lib/geocoder/results/base.rb', line 17
def address(format = :full)
fail
end
|
#coordinates ⇒ Object
A two-element array: [lat, lon].
24
25
26
|
# File 'lib/geocoder/results/base.rb', line 24
def coordinates
[@data['latitude'].to_f, @data['longitude'].to_f]
end
|
#country ⇒ Object
52
53
54
|
# File 'lib/geocoder/results/base.rb', line 52
def country
fail
end
|
#country_code ⇒ Object
56
57
58
|
# File 'lib/geocoder/results/base.rb', line 56
def country_code
fail
end
|
#latitude ⇒ Object
28
29
30
|
# File 'lib/geocoder/results/base.rb', line 28
def latitude
coordinates[0]
end
|
#longitude ⇒ Object
32
33
34
|
# File 'lib/geocoder/results/base.rb', line 32
def longitude
coordinates[1]
end
|
#province ⇒ Object
40
41
42
|
# File 'lib/geocoder/results/base.rb', line 40
def province
state
end
|
#province_code ⇒ Object
48
49
50
|
# File 'lib/geocoder/results/base.rb', line 48
def province_code
state_code
end
|
#state ⇒ Object
36
37
38
|
# File 'lib/geocoder/results/base.rb', line 36
def state
fail
end
|
#state_code ⇒ Object
44
45
46
|
# File 'lib/geocoder/results/base.rb', line 44
def state_code
fail
end
|