From 337430ae48465814711ed4fc7f83b29759256a61 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Wed, 16 Mar 2011 10:09:06 -0400 Subject: [PATCH] Move Geocoder.cache method to lib/geocoder.rb. --- lib/geocoder.rb | 12 +++++++++++- lib/geocoder/cache.rb | 11 ----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/geocoder.rb b/lib/geocoder.rb index 594f3df8..268e7b72 100644 --- a/lib/geocoder.rb +++ b/lib/geocoder.rb @@ -34,6 +34,16 @@ module Geocoder end end + ## + # 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 + end + # exception classes class Error < StandardError; end @@ -50,7 +60,7 @@ module Geocoder if ip get_lookup :freegeoip else - get_lookup Geocoder::Configuration.lookup || :google + get_lookup Configuration.lookup || :google end end diff --git a/lib/geocoder/cache.rb b/lib/geocoder/cache.rb index 82d47d09..f291575c 100644 --- a/lib/geocoder/cache.rb +++ b/lib/geocoder/cache.rb @@ -1,15 +1,4 @@ module Geocoder - - ## - # The working Cache object, or +nil+ if none configured. - # - def self.cache - if @cache.nil? and store = Geocoder::Configuration.cache - @cache = Cache.new(store, Geocoder::Configuration.cache_prefix) - end - @cache - end - class Cache def initialize(store, prefix) -- GitLab