class Geocoder::Result::Mapbox
def address
def address [place_name, street, city, state, postal_code, country].compact.join(', ') end
def city
def city context_part('place') end
def context
def context Array(data['context']) end
def context_part(name, key = 'text')
def context_part(name, key = 'text') (context.detect { |c| c['id'] =~ Regexp.new(name) } || {})[key] end
def coordinates
def coordinates data['geometry']['coordinates'].reverse.map(&:to_f) end
def country
def country context_part('country') end
def country_code
def country_code value = context_part('country', 'short_code') value.upcase unless value.nil? end
def neighborhood
def neighborhood context_part('neighborhood') end
def place_name
def place_name data['text'] end
def postal_code
def postal_code context_part('postcode') end
def state
def state context_part('region') end
def state_code
def state_code value = context_part('region', 'short_code') value.split('-').last unless value.nil? end
def street
def street data['properties']['address'] end