lib/stockpile.rb in stockpile-1.1 vs lib/stockpile.rb in stockpile-2.0
- old
+ new
@@ -1,6 +1,6 @@
-# coding: utf-8
+# frozen_string_literal: true
require 'forwardable'
# Stockpile is a thin wrapper around connections to a fast key-value store
# used for caching (currently only supporting Redis).
@@ -12,11 +12,11 @@
# gets shared by all clients using a Stockpile instance.
# * Providing an application-level cache adapter mechanism.
class Stockpile
extend Forwardable
- VERSION = "1.1" # :nodoc:
+ VERSION = '2.0' # :nodoc:
@default_manager = nil
class << self
# Determines if the default connection width is narrow or wide based on
@@ -73,11 +73,11 @@
# # or adapt LastRunTime to recognize #last_run_time.
# AdaptableApplication.cache_adapter!(LastRunTime)
# LastRunTime.last_run_time('adaptable_application')
def inject!(mod, options = {})
unless mod.kind_of?(Module)
- raise ArgumentError, "#{mod} is not a class or module"
+ fail ArgumentError, "#{mod} is not a class or module"
end
name = options.fetch(:method, :cache).to_sym
mklass = mod.singleton_class
default = options.fetch(:default_manager, nil)
@@ -172,10 +172,10 @@
options = options.dup
manager = options.delete(:manager)
default = options.delete(:default_manager) || self.class.default_manager
unless manager || default
- raise ArgumentError, "No connection manager provided or set as default."
+ fail ArgumentError, 'No connection manager provided or set as default.'
end
manager ||= default
clients = [