Skip to content

Commit

Permalink
Merge pull request #876 from GustavoCaso/undef-==-from-redis-future
Browse files Browse the repository at this point in the history
Deprecate ==  and != from Redis::Future
  • Loading branch information
byroot committed Sep 19, 2019
2 parents a2c562c + c1d0561 commit 6b894f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/redis.rb
Expand Up @@ -5,6 +5,10 @@

class Redis

def self.deprecate(message, trace = caller[0])
$stderr.puts "\n#{message} (in #{trace})"
end

def self.current
@current ||= Redis.new
end
Expand Down
7 changes: 7 additions & 0 deletions lib/redis/pipeline.rb
Expand Up @@ -139,6 +139,13 @@ def initialize(command, transformation, timeout)
@object = FutureNotReady
end

def ==(*)
message = "The method == and != is deprecated for Redis::Future and will be removed in 4.2.0"
message << " - You probably meant to call .value == or .value !="
::Redis.deprecate(message)
super
end

def inspect
"<Redis::Future #{@command.inspect}>"
end
Expand Down

0 comments on commit 6b894f8

Please sign in to comment.