Warn if Redis gem is < 3.0.0

Prefer printing a log message if this criteria is not met, instead of
failing silently.
This commit is contained in:
Rob Watson 2017-02-20 14:11:32 +00:00
parent dc308add10
commit 69ab514477

View file

@ -4,6 +4,13 @@ module Rack
class Attack
module StoreProxy
class RedisStoreProxy < SimpleDelegator
def initialize(*args)
major_version = Redis::VERSION.split('.').first.to_i
warn 'RackAttack requires Redis gem >= 3.0.0.' if major_version < 3
super(*args)
end
def self.handle?(store)
defined?(::Redis::Store) && store.is_a?(::Redis::Store)
end