Class: DripDrop::ZMQBaseHandler
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from BaseHandler
#handle_error, #on_error, #print_exception
Constructor Details
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.default_message_class
end
|
Instance Attribute Details
#connection ⇒ Object
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
46
47
48
|
# File 'lib/dripdrop/handlers/zeromq.rb', line 46
def address
self.connection.address
end
|
#on_receive(msg_format = :dripdrop, &block) ⇒ Object
36
37
38
39
|
# File 'lib/dripdrop/handlers/zeromq.rb', line 36
def on_receive(msg_format=:dripdrop,&block)
@recv_cbak = block
self
end
|
#on_recv(*args, &block) ⇒ Object
41
42
43
44
|
# File 'lib/dripdrop/handlers/zeromq.rb', line 41
def on_recv(*args,&block)
$stderr.write "DripDrop Warning :on_recv is deprecated in favor of :on_receive"
on_receive(*args,&block)
end
|
#post_setup ⇒ Object
Triggered after a handler is setup
51
|
# File 'lib/dripdrop/handlers/zeromq.rb', line 51
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
|