module Geocoder::Result

Public Instance Methods

admin_locality() click to toggle source
# File lib/geocoder/results/yandex.rb, line 249
def admin_locality
  find_in_hash(@data, *ADMIN_LEVEL, 'Locality')
end
country_level_locality() click to toggle source
# File lib/geocoder/results/yandex.rb, line 245
def country_level_locality
  find_in_hash(@data, *COUNTRY_LEVEL, 'Locality')
end
dependent_locality() click to toggle source
# File lib/geocoder/results/yandex.rb, line 257
def dependent_locality
  find_in_hash(@data, *DEPENDENT_LOCALITY_1) ||
    find_in_hash(@data, *DEPENDENT_LOCALITY_2)
end
find_in_hash(source, *keys) click to toggle source
# File lib/geocoder/results/yandex.rb, line 279
def find_in_hash(source, *keys)
  key = keys.shift
  result = source[key]

  if keys.empty?
    return result
  elsif !result.is_a?(Hash)
    return nil
  end

  find_in_hash(result, *keys)
end
locality_data() click to toggle source
# File lib/geocoder/results/yandex.rb, line 262
def locality_data
  dependent_locality || subadmin_locality || admin_locality ||
    country_level_locality || top_level_locality
end
premise() click to toggle source
# File lib/geocoder/results/yandex.rb, line 271
def premise
  if thoroughfare_data.is_a?(Hash)
    thoroughfare_data['Premise']
  elsif locality_data.is_a?(Hash)
    locality_data['Premise']
  end
end
subadmin_locality() click to toggle source
# File lib/geocoder/results/yandex.rb, line 253
def subadmin_locality
  find_in_hash(@data, *SUBADMIN_LEVEL, 'Locality')
end
thoroughfare_data() click to toggle source
# File lib/geocoder/results/yandex.rb, line 267
def thoroughfare_data
  locality_data['Thoroughfare'] if locality_data.is_a?(Hash)
end