Merge pull request #271 from grzuy/ruby_2-5

[Fixes #253] Avoid 'defined?' buggy behavior in ruby 2.5.0
This commit is contained in:
Gonzalo Rodriguez 2018-03-09 10:20:22 -03:00 committed by GitHub
commit bed046ee75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,14 @@ module Rack
module StoreProxy
class RedisStoreProxy < SimpleDelegator
def self.handle?(store)
defined?(::Redis::Store) && store.is_a?(::Redis::Store)
# Using const_defined? for now.
#
# Go back to use defined? once this ruby issue is
# fixed and released:
# https://bugs.ruby-lang.org/issues/14407
#
# defined?(::Redis::Store) && store.is_a?(::Redis::Store)
const_defined?("::Redis::Store") && store.is_a?(::Redis::Store)
end
def initialize(store)