diff --git a/lib/redis/commands.rb b/lib/redis/commands.rb index ddf264d95..179c2200a 100644 --- a/lib/redis/commands.rb +++ b/lib/redis/commands.rb @@ -199,8 +199,8 @@ module Commands # hash, are up to consumers. # # Redis error replies are raised as Ruby exceptions. - def call(*command) - send_command(command) + def call(*command, &block) + send_command(command, &block) end # Interact with the sentinel command (masters, master, slaves, failover) diff --git a/test/redis/client_test.rb b/test/redis/client_test.rb index bec97431c..cad913077 100644 --- a/test/redis/client_test.rb +++ b/test/redis/client_test.rb @@ -15,6 +15,11 @@ def test_call_with_arguments assert_equal result, "OK" end + def test_with_block + result = r.call("INFO") { |l| l.lines(chomp: true).grep(/uptime_in_days/)[0] } + assert_equal result, "uptime_in_days:0" + end + def test_call_integers result = r.call("INCR", "foo") assert_equal result, 1