lib/amqp/channel.rb in amqp-0.8.0.rc1 vs lib/amqp/channel.rb in amqp-0.8.0.rc2

- old
+ new

@@ -116,15 +116,20 @@ @channel_is_open_deferrable = AMQ::Client::EventMachineClient::Deferrable.new # only send channel.open when connection is actually open. Makes it possible to # do c = AMQP.connect; AMQP::Channel.new(c) that is what some people do. MK. @connection.on_open do - self.open do |*args| + self.open do |ch, open_ok| @channel_is_open_deferrable.succeed - block.call(*args) if block - end - end + if block + case block.arity + when 1 then block.call(ch) + else block.call(ch, open_ok) + end # case + end # if + end # self.open + end # @connection.on_open end def once_open(&block) @channel_is_open_deferrable.callback(&block)