Class: Geocoder::Result::GeocoderUs
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::GeocoderUs
show all
- Defined in:
- lib/geocoder/results/geocoder_us.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #latitude, #longitude, #province, #province_code
Instance Method Details
#address(format = :full) ⇒ Object
9
10
11
|
# File 'lib/geocoder/results/geocoder_us.rb', line 9
def address(format = :full)
"#{street_address}, #{city}, #{state} #{postal_code}, #{country}".sub(/^[ ,]*/, "")
end
|
#city ⇒ Object
17
18
19
|
# File 'lib/geocoder/results/geocoder_us.rb', line 17
def city
@data[3]
end
|
#coordinates ⇒ Object
5
6
7
|
# File 'lib/geocoder/results/geocoder_us.rb', line 5
def coordinates
[@data[0].to_f, @data[1].to_f]
end
|
#country ⇒ Object
31
32
33
|
# File 'lib/geocoder/results/geocoder_us.rb', line 31
def country
'United States'
end
|
#country_code ⇒ Object
35
36
37
|
# File 'lib/geocoder/results/geocoder_us.rb', line 35
def country_code
'US'
end
|
#postal_code ⇒ Object
27
28
29
|
# File 'lib/geocoder/results/geocoder_us.rb', line 27
def postal_code
@data[5]
end
|
#state ⇒ Object
Also known as:
state_code
21
22
23
|
# File 'lib/geocoder/results/geocoder_us.rb', line 21
def state
@data[4]
end
|
#street_address ⇒ Object
13
14
15
|
# File 'lib/geocoder/results/geocoder_us.rb', line 13
def street_address
@data[2]
end
|