Class: Geogle::Model::Place
- Inherits:
-
Object
- Object
- Geogle::Model::Place
show all
- Defined in:
- lib/geogle/model/place.rb
Constant Summary
collapse
- TYPES =
%w(street_address
route political
country
administrative_area_level_1
administrative_area_level_2
administrative_area_level_3
colloquial_area
locality
sublocality
neighborhood
premise
subpremise
postal_code
natural_feature
airport
park
point_of_interest
post_box
street_number
floor
room)
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, &block) ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/geogle/model/place.rb', line 65
def method_missing(method, &block)
if method.to_s =~ /^is_(.+?)?$/ && TYPES.include?(method)
is_type?($1)
else
super
end
end
|
Instance Method Details
#city ⇒ Object
49
50
51
|
# File 'lib/geogle/model/place.rb', line 49
def city
address.area_level_2
end
|
#country ⇒ Object
57
58
59
|
# File 'lib/geogle/model/place.rb', line 57
def country
address.country
end
|
#country_code ⇒ Object
61
62
63
|
# File 'lib/geogle/model/place.rb', line 61
def country_code
address.country_code
end
|
#geo_location ⇒ Object
37
38
39
|
# File 'lib/geogle/model/place.rb', line 37
def geo_location
geometry.location
end
|
#locality ⇒ Object
45
46
47
|
# File 'lib/geogle/model/place.rb', line 45
def locality
address.locality
end
|
#state ⇒ Object
53
54
55
|
# File 'lib/geogle/model/place.rb', line 53
def state
address.area_level_1
end
|
#street ⇒ Object
41
42
43
|
# File 'lib/geogle/model/place.rb', line 41
def street
address.street
end
|