Class: DataMapper::GeoKit::GeographicLocation
- Inherits:
-
Object
- Object
- DataMapper::GeoKit::GeographicLocation
- Defined in:
- lib/dm-geokit/resource.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#full_address ⇒ Object
Returns the value of attribute full_address.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lng ⇒ Object
Returns the value of attribute lng.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street_address ⇒ Object
Returns the value of attribute street_address.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
-
#initialize(field, obj) ⇒ GeographicLocation
constructor
A new instance of GeographicLocation.
- #to_lat_lng ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(field, obj) ⇒ GeographicLocation
Returns a new instance of GeographicLocation.
127 128 129 130 131 132 |
# File 'lib/dm-geokit/resource.rb', line 127 def initialize(field, obj) PROPERTY_NAMES.each do |p| instance_variable_set("@#{p}",obj.send("#{field}_#{p}")) end @distance = obj.send("#{field}_distance") if obj.respond_to?("#{field}_distance".to_sym) end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def city @city end |
#country_code ⇒ Object
Returns the value of attribute country_code.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def country_code @country_code end |
#distance ⇒ Object
Returns the value of attribute distance.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def distance @distance end |
#full_address ⇒ Object
Returns the value of attribute full_address.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def full_address @full_address end |
#lat ⇒ Object
Returns the value of attribute lat.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def lat @lat end |
#lng ⇒ Object
Returns the value of attribute lng.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def lng @lng end |
#state ⇒ Object
Returns the value of attribute state.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def state @state end |
#street_address ⇒ Object
Returns the value of attribute street_address.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def street_address @street_address end |
#zip ⇒ Object
Returns the value of attribute zip.
126 127 128 |
# File 'lib/dm-geokit/resource.rb', line 126 def zip @zip end |
Instance Method Details
#to_lat_lng ⇒ Object
136 137 138 |
# File 'lib/dm-geokit/resource.rb', line 136 def to_lat_lng ::GeoKit::LatLng.new(@lat,@lng) end |
#to_s ⇒ Object
133 134 135 |
# File 'lib/dm-geokit/resource.rb', line 133 def to_s @full_address end |