Skip to content

Commit a675945

Browse files
mlarrazbyroot
authored andcommitted
Forward blocks on Redis#call
This matches the behavior of RedisClient#call
1 parent a1d6f68 commit a675945

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: lib/redis/commands.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ module Commands
199199
# hash, are up to consumers.
200200
#
201201
# Redis error replies are raised as Ruby exceptions.
202-
def call(*command)
203-
send_command(command)
202+
def call(*command, &block)
203+
send_command(command, &block)
204204
end
205205

206206
# Interact with the sentinel command (masters, master, slaves, failover)

Diff for: test/redis/client_test.rb

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ def test_call_with_arguments
1515
assert_equal result, "OK"
1616
end
1717

18+
def test_with_block
19+
result = r.call("INFO") { |l| l.lines(chomp: true).grep(/uptime_in_days/)[0] }
20+
assert_equal result, "uptime_in_days:0"
21+
end
22+
1823
def test_call_integers
1924
result = r.call("INCR", "foo")
2025
assert_equal result, 1

0 commit comments

Comments
 (0)