Skip to content

Commit 6b894f8

Browse files
authored
Merge pull request #876 from GustavoCaso/undef-==-from-redis-future
Deprecate == and != from Redis::Future
2 parents a2c562c + c1d0561 commit 6b894f8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/redis.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
class Redis
77

8+
def self.deprecate(message, trace = caller[0])
9+
$stderr.puts "\n#{message} (in #{trace})"
10+
end
11+
812
def self.current
913
@current ||= Redis.new
1014
end

lib/redis/pipeline.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ def initialize(command, transformation, timeout)
139139
@object = FutureNotReady
140140
end
141141

142+
def ==(*)
143+
message = "The method == and != is deprecated for Redis::Future and will be removed in 4.2.0"
144+
message << " - You probably meant to call .value == or .value !="
145+
::Redis.deprecate(message)
146+
super
147+
end
148+
142149
def inspect
143150
"<Redis::Future #{@command.inspect}>"
144151
end

0 commit comments

Comments
 (0)