diff --git a/lib/geocoder.rb b/lib/geocoder.rb index b3bae2bff6f1899aff6b258e4d6b70612b959555..53e9860b7c8ca3e0aea3e59bd7f12c625d95f94c 100644 --- a/lib/geocoder.rb +++ b/lib/geocoder.rb @@ -44,7 +44,7 @@ module Geocoder # def cache warn "WARNING: Calling Geocoder.cache is DEPRECATED. The #cache method now belongs to the Geocoder::Lookup object." - Geocoder::Lookup.get(Geocoder.config.lookup).send(:configuration).cache + Geocoder::Lookup.get(Geocoder.config.lookup).cache end end diff --git a/lib/geocoder/lookups/base.rb b/lib/geocoder/lookups/base.rb index 4120fc7041646ec1790557987060d03101e8b02e..28ad577b25df6517557e12c49abe9f1efd1a1a8f 100644 --- a/lib/geocoder/lookups/base.rb +++ b/lib/geocoder/lookups/base.rb @@ -72,6 +72,16 @@ module Geocoder def query_url(query) fail end + + ## + # The working Cache object. + # + def cache + if @cache.nil? and store = configuration.cache + @cache = Cache.new(store, configuration.cache_prefix) + end + @cache + end private # ------------------------------------------------------------- @@ -225,16 +235,6 @@ module Geocoder end end - ## - # The working Cache object. - # - def cache - if @cache.nil? and store = configuration.cache - @cache = Cache.new(store, configuration.cache_prefix) - end - @cache - end - ## # Simulate ActiveSupport's Object#to_query. # Removes any keys with nil value.