Class: Cocaine::ChannelCombiner

Inherits:
Object
  • Object
show all
Defined in:
lib/cocaine/asio/channel/combiner.rb

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ ChannelCombiner

Returns a new instance of ChannelCombiner.



4
5
6
7
8
9
10
11
# File 'lib/cocaine/asio/channel/combiner.rb', line 4

def initialize(channel)
  channel.callback { |result|
    @callback.call Cocaine::Future.value result if @callback
  }
  channel.errback { |err|
    @callback.call Cocaine::Future.error err if @callback
  }
end

Instance Method Details

#callback(&block) ⇒ Object



13
14
15
# File 'lib/cocaine/asio/channel/combiner.rb', line 13

def callback(&block)
  @callback = block
end