lib/geocoder/results/yandex.rb in geocoder-1.1.6 vs lib/geocoder/results/yandex.rb in geocoder-1.1.7

- old
+ new

@@ -14,12 +14,14 @@ def city if state.empty? address_details['Locality']['LocalityName'] elsif sub_state.empty? address_details['AdministrativeArea']['Locality']['LocalityName'] - else - address_details['AdministrativeArea']['SubAdministrativeArea']['Locality']['LocalityName'] + elsif not sub_state_city.empty? + sub_state_city + else + "" end end def country address_details['CountryName'] @@ -63,8 +65,16 @@ private # ---------------------------------------------------------------- def address_details @data['GeoObject']['metaDataProperty']['GeocoderMetaData']['AddressDetails']['Country'] + end + + def sub_state_city + if sub_state && sub_state["Locality"] + sub_state['Locality']['LocalityName'] + else + "" + end end end end