Class: DataMapper::GeoKit::GeographicLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-geokit/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, obj) ⇒ GeographicLocation

Returns a new instance of GeographicLocation.



164
165
166
167
168
169
# File 'lib/dm-geokit/resource.rb', line 164

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

#cityObject

Returns the value of attribute city.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def city
  @city
end

#country_codeObject

Returns the value of attribute country_code.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def country_code
  @country_code
end

#distanceObject

Returns the value of attribute distance.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def distance
  @distance
end

#full_addressObject

Returns the value of attribute full_address.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def full_address
  @full_address
end

#latObject

Returns the value of attribute lat.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def lat
  @lat
end

#lngObject

Returns the value of attribute lng.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def lng
  @lng
end

#stateObject

Returns the value of attribute state.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def state
  @state
end

#street_addressObject

Returns the value of attribute street_address.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def street_address
  @street_address
end

#zipObject

Returns the value of attribute zip.



163
164
165
# File 'lib/dm-geokit/resource.rb', line 163

def zip
  @zip
end

Instance Method Details

#to_lat_lngObject



173
174
175
# File 'lib/dm-geokit/resource.rb', line 173

def to_lat_lng
  ::GeoKit::LatLng.new(@lat,@lng)
end

#to_sObject



170
171
172
# File 'lib/dm-geokit/resource.rb', line 170

def to_s
  @full_address
end