class Geocoder::Result::Base
def address(format = :full)
through this method.
return properly formatted addresses and those should be funneled
format and will return incorrect results for most countries. Some APIs
This default implementation dumbly follows the United States address
A string in the given format.
#
def address(format = :full) if state_code.to_s != "" s = ", #{state_code}" elsif state.to_s != "" s = ", #{state}" else s = "" end "#{city}#{s} #{postal_code}, #{country}".sub(/^[ ,]*/, '') end
def coordinates
A two-element array: [lat, lon].
#
def coordinates [@data['latitude'].to_f, @data['longitude'].to_f] end
def country
def country fail end
def country_code
def country_code fail end
def initialize(data)
Takes a hash of data from a parsed geocoding service response.
#
def initialize(data) @data = data @cache_hit = nil end
def latitude
def latitude coordinates[0] end
def longitude
def longitude coordinates[1] end
def province
def province state end
def province_code
def province_code state_code end
def state
def state fail end
def state_code
def state_code fail end