Class: DripDrop::ZMQBaseHandler

Inherits:
BaseHandler show all
Defined in:
lib/dripdrop/handlers/zeromq.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
# File 'lib/dripdrop/handlers/zeromq.rb', line 17

def initialize(opts={})
  @opts         = opts
  @connection   = nil
  @msg_format   = opts[:msg_format] || :dripdrop
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



15
16
17
# File 'lib/dripdrop/handlers/zeromq.rb', line 15

def connection
  @connection
end

Instance Method Details

#addressObject



29
30
31
# File 'lib/dripdrop/handlers/zeromq.rb', line 29

def address
  self.connection.address
end

#on_recv(msg_format = :dripdrop, &block) ⇒ Object



23
24
25
26
27
# File 'lib/dripdrop/handlers/zeromq.rb', line 23

def on_recv(msg_format=:dripdrop,&block)
  @msg_format = msg_format
  @recv_cbak = block
  self
end

#post_setupObject

Triggered after a handler is setup



34
# File 'lib/dripdrop/handlers/zeromq.rb', line 34

def post_setup; end