From 97765371bb139f15cc13bb7c8b8824a38021ba35 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Sat, 8 Dec 2012 12:40:21 -0500 Subject: [PATCH] Deprecate Geocoder.cache method. Cache is now lookup-specific. --- lib/geocoder.rb | 6 ++---- lib/geocoder/lookups/base.rb | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/geocoder.rb b/lib/geocoder.rb index 4019e845..b3bae2bf 100644 --- a/lib/geocoder.rb +++ b/lib/geocoder.rb @@ -43,10 +43,8 @@ module Geocoder # The working Cache object, or +nil+ if none configured. # def cache - if @cache.nil? and store = Configuration.cache - @cache = Cache.new(store, Configuration.cache_prefix) - end - @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 end end diff --git a/lib/geocoder/lookups/base.rb b/lib/geocoder/lookups/base.rb index f1874248..821a87b9 100644 --- a/lib/geocoder/lookups/base.rb +++ b/lib/geocoder/lookups/base.rb @@ -230,7 +230,10 @@ module Geocoder # The working Cache object. # def cache - Geocoder.cache + if @cache.nil? and store = configuration.cache + @cache = Cache.new(store, configuration.cache_prefix) + end + @cache end ## -- GitLab