Sha256: f56a8b283350ec3dababfe0fd651897602aaba585ff5791dac081b5088c659b7
Contents?: true
Size: 1.18 KB
Versions: 43
Compression:
Stored size: 1.18 KB
Contents
require 'geocoder/results/base' module Geocoder::Result class Latlon < Base def city address_components["city"] end def coordinates [@data['lat'].to_f, @data['lon'].to_f] end def country "United States" # LatLon.io only supports the US end def country_code "US" # LatLon.io only supports the US end def formatted_address(format = :full) address_components["address"] end alias_method :address, :formatted_address def number address_components["number"] end def prefix address_components["prefix"] end def state address_components["state"] end alias_method :state_code, :state def street [street_name, street_type].compact.join(' ') end def street_name address_components["street_name"] end def street_type address_components["street_type"] end def suffix address_components["suffix"] end def unit address_components["unit"] end def zip address_components["zip"] end alias_method :postal_code, :zip private def address_components @data["address"] || {} end end end
Version data entries
43 entries across 43 versions & 4 rubygems
Version | Path |
---|---|
geocoder-1.3.4 | lib/geocoder/results/latlon.rb |
geocoder-1.3.3 | lib/geocoder/results/latlon.rb |
geocoder-1.3.2 | lib/geocoder/results/latlon.rb |