From 897e6ffa3d54fd36656bf1d41d8a72db3a9603aa Mon Sep 17 00:00:00 2001 From: Alexey Noskov <alexey.noskov@gmail.com> Date: Sat, 22 Dec 2012 00:50:00 +0400 Subject: [PATCH] Sub state for Google result --- lib/geocoder/results/google.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/geocoder/results/google.rb b/lib/geocoder/results/google.rb index e293c0ba..4250ce0f 100644 --- a/lib/geocoder/results/google.rb +++ b/lib/geocoder/results/google.rb @@ -35,6 +35,18 @@ module Geocoder::Result end end + def sub_state + if state = address_components_of_type(:administrative_area_level_2).first + state['long_name'] + end + end + + def sub_state_code + if state = address_components_of_type(:administrative_area_level_2).first + state['short_name'] + end + end + def country if country = address_components_of_type(:country).first country['long_name'] -- GitLab