Class: EventMachine::Protocols::Zmq2::DealerCb
- Defined in:
- lib/em/protocols/zmq2/dealer.rb
Overview
Convinient Dealer class which accepts callback in constructor, which will be called on every incoming message (instead of #receive_message)
Instance Method Summary collapse
-
#initialize(opts = {}, cb = nil, &block) ⇒ DealerCb
constructor
Accepts callback as second parameter or block :call-seq: new(opts) do |message| end new(opts, proc{|message| }).
-
#receive_message(message) ⇒ Object
:nodoc:.
Methods inherited from Dealer
#flush_queue, #peer_free, #raw_send_message, #send_message
Methods inherited from PreDealer
#choose_peer, #receive_message_and_peer, #send_message
Constructor Details
#initialize(opts = {}, cb = nil, &block) ⇒ DealerCb
Accepts callback as second parameter or block :call-seq:
new(opts) do || end
new(opts, proc{|| })
140 141 142 143 |
# File 'lib/em/protocols/zmq2/dealer.rb', line 140 def initialize(opts = {}, cb = nil, &block) super opts @read_callback = cb || block end |
Instance Method Details
#receive_message(message) ⇒ Object
:nodoc:
145 146 147 |
# File 'lib/em/protocols/zmq2/dealer.rb', line 145 def () # :nodoc: @read_callback.call end |