diff --git a/lib/geocoder.rb b/lib/geocoder.rb index 594f3df8cb35b4e567e92e82f290dfd61d2bcc32..268e7b728e4d3a2fa0c147076b860b8c27b23a8f 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 82d47d09113323559c61b5c9ca1a78e9d0862d5e..f291575ce266842cc930dece6b3e543e7ebb1a14 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)