Skip to content

Commit

Permalink
try EventMachine::Completion
Browse files Browse the repository at this point in the history
  • Loading branch information
AE9RB committed Jul 31, 2011
1 parent 7438979 commit 8d6485c
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions lib/redis/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,26 @@ module Redis
class Client < EventMachine::Connection

include Sender

class Command

include EventMachine::Deferrable

def initialize connection
@connection = connection

if defined? EventMachine::Completion
class Command < EventMachine::Completion
end

undef_method :timeout

# EventMachine older than 1.0.0.beta.4 doesn't return self
test = self.new nil
else
class Command
include EventMachine::Deferrable
end
end
class Command
# EventMachine::Deferrable older than 1.0.0.beta.4 doesn't return self
# EventMachine::Completion doesn't return self in any version
test = self.new
unless self === test.callback{}
def callback; super; self; end
def errback; super; self; end
end

end

def initialize options={}
def initialize *ignore_args
if defined? Hiredis and defined? Hiredis::Reader
@reader = Hiredis::Reader.new
else
Expand Down Expand Up @@ -173,7 +172,7 @@ def self.transforms
private

def new_command do_send, do_transform, method, *args
command = Command.new self
command = Command.new
if do_send
send_redis args.reduce([method]){ |arr, arg|
if Hash === arg
Expand Down

0 comments on commit 8d6485c

Please sign in to comment.