Class: DripDrop::ZMQBaseHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- DripDrop::ZMQBaseHandler
- Defined in:
- lib/dripdrop/handlers/zeromq.rb
Direct Known Subclasses
Mongrel2Handler, ZMQPubHandler, ZMQPullHandler, ZMQPushHandler, ZMQSubHandler, ZMQXRepHandler, DripDrop::ZMQXRepHandler::Response, ZMQXReqHandler
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #add_connection(connection) ⇒ Object
- #address ⇒ Object
-
#initialize(opts = {}) ⇒ ZMQBaseHandler
constructor
A new instance of ZMQBaseHandler.
- #on_recv(msg_format = :dripdrop, &block) ⇒ Object
-
#post_setup ⇒ Object
Triggered after a handler is setup.
- #read_connection ⇒ Object
- #write_connection ⇒ Object
Methods inherited from BaseHandler
#handle_error, #on_error, #print_exception
Constructor Details
#initialize(opts = {}) ⇒ ZMQBaseHandler
Returns a new instance of ZMQBaseHandler.
17 18 19 20 21 22 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 17 def initialize(opts={}) @opts = opts @connection = nil @msg_format = opts[:msg_format] || :dripdrop @message_class = @opts[:message_class] || DripDrop. end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
15 16 17 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 15 def connection @connection end |
Instance Method Details
#add_connection(connection) ⇒ Object
24 25 26 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 24 def add_connection(connection) @connection = connection end |
#address ⇒ Object
41 42 43 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 41 def address self.connection.address end |
#on_recv(msg_format = :dripdrop, &block) ⇒ Object
36 37 38 39 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 36 def on_recv(msg_format=:dripdrop,&block) @recv_cbak = block self end |
#post_setup ⇒ Object
Triggered after a handler is setup
46 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 46 def post_setup; end |
#read_connection ⇒ Object
28 29 30 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 28 def read_connection @connection end |
#write_connection ⇒ Object
32 33 34 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 32 def write_connection @connection end |