From 0292c554676a4c5c89abf116cba7b07fec0cd100 Mon Sep 17 00:00:00 2001 From: Mike Pastore Date: Tue, 24 Oct 2017 18:19:01 -0500 Subject: [PATCH] Add call! method that delegates to Redic#call!. --- lib/redic/pool.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/redic/pool.rb b/lib/redic/pool.rb index 4acf428..65bbdd1 100644 --- a/lib/redic/pool.rb +++ b/lib/redic/pool.rb @@ -14,12 +14,6 @@ def initialize(url, options = {}) @id = "redic-pool-#{object_id}" end - def call(*args) - @pool.with do |client| - client.call(*args) - end - end - def queue(*args) Thread.current[@id] || (Thread.current[@id] = []) Thread.current[@id] << args @@ -38,4 +32,14 @@ def commit result end end + + %w[call call!].each do |method| + eval <<-STR + def #{method}(*args) + pool.with do |client| + client.#{method}(*args) + end + end + STR + end end