Class: DripDrop::ZMQBaseHandler

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

Direct Known Subclasses

Mongrel2Handler, ZMQPubHandler, ZMQPullHandler, ZMQPushHandler, ZMQSubHandler, ZMQXRepHandler, DripDrop::ZMQXRepHandler::Response, ZMQXReqHandler

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from BaseHandler

#handle_error, #on_error, #print_exception

Constructor Details

- (ZMQBaseHandler) initialize(opts = {})



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

- (Object) connection (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

- (Object) add_connection(connection)



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

def add_connection(connection)
  @connection = connection
end

- (Object) address



46
47
48
# File 'lib/dripdrop/handlers/zeromq.rb', line 46

def address
  self.connection.address
end

- (Object) on_receive(msg_format = :dripdrop, &block)



36
37
38
39
# File 'lib/dripdrop/handlers/zeromq.rb', line 36

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

- (Object) on_recv(*args, &block)



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

- (Object) post_setup

Triggered after a handler is setup



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

def post_setup; end

- (Object) read_connection



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

def read_connection
  @connection
end

- (Object) write_connection



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

def write_connection
  @connection
end