File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 5
5
6
6
class Redis
7
7
8
+ def self . deprecate ( message , trace = caller [ 0 ] )
9
+ $stderr. puts "\n #{ message } (in #{ trace } )"
10
+ end
11
+
8
12
def self . current
9
13
@current ||= Redis . new
10
14
end
Original file line number Diff line number Diff line change @@ -132,16 +132,20 @@ class Future < BasicObject
132
132
133
133
attr_reader :timeout
134
134
135
- # Avoid allowing people to use == inside a pipelined
136
- undef :==
137
-
138
135
def initialize ( command , transformation , timeout )
139
136
@command = command
140
137
@transformation = transformation
141
138
@timeout = timeout
142
139
@object = FutureNotReady
143
140
end
144
141
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
+
145
149
def inspect
146
150
"<Redis::Future #{ @command . inspect } >"
147
151
end
Original file line number Diff line number Diff line change @@ -126,14 +126,6 @@ def test_futures_raise_when_trying_to_access_their_values_too_early
126
126
end
127
127
end
128
128
129
- def test_futures_raise_when_trying_to_compare_their_value_too_early
130
- r . pipelined do
131
- assert_raises ( NoMethodError ) do
132
- r . sadd ( "foo" , 1 ) == 1
133
- end
134
- end
135
- end
136
-
137
129
def test_futures_raise_when_command_errors_and_needs_transformation
138
130
assert_raises ( Redis ::CommandError ) do
139
131
r . pipelined do
You can’t perform that action at this time.
0 commit comments