Sha256: 81d3963e0372a98f139bf1d45e712838d0ec40ef4e2304a8054b4d7f49857568
Contents?: true
Size: 1.48 KB
Versions: 54
Compression:
Stored size: 1.48 KB
Contents
require 'geocoder/results/nominatim' module Geocoder::Result Nominatim.class_eval do ## Additional Stuff def city %w[city town village hamlet].each do |key| return @data['address'][key] if @data['address'].key?(key) end @data['display_name'].split(',').count > 3 ? @data['display_name'].split(',')[-3].strip : nil # return nil end def street %w[road pedestrian highway].each do |key| return @data['address'][key] if @data['address'].key?(key) end return nil end def street_number @data['address']['house_number'] end def country_code @data['address']['country_code'].present? ? @data['address']['country_code'].to_s.upcase : nil end def district @data['address']['city_district'].present? ? @data['address']['city_district'] : nil end def subdistrict @data['address']['suburb'].present? ? @data['address']['suburb'] : nil end def city_code %w[city town village hamlet].each do |key| return @data['address'][key] if @data['address'].key?(key) end @data['display_name'].split(',').count > 3 ? @data['display_name'].split(',')[-3].strip : nil end def district_code @data['address']['city_district'].present? ? @data['address']['city_district'] : nil end def subdistrict_code @data['address']['suburb'].present? ? @data['address']['suburb'] : nil end end end
Version data entries
54 entries across 54 versions & 1 rubygems