Class: Jackrabbit::MessageReceiver

Inherits:
Object
  • Object
show all
Defined in:
lib/jackrabbit/message_receiver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, options = {}, &block) ⇒ MessageReceiver

Returns a new instance of MessageReceiver.



5
6
7
8
9
# File 'lib/jackrabbit/message_receiver.rb', line 5

def initialize(channel, options = {}, &block)
  @channel = channel
  @options = options
  handle_with(&block) if block_given?
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



3
4
5
# File 'lib/jackrabbit/message_receiver.rb', line 3

def channel
  @channel
end

#handlerObject (readonly)

Returns the value of attribute handler.



3
4
5
# File 'lib/jackrabbit/message_receiver.rb', line 3

def handler
  @handler
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/jackrabbit/message_receiver.rb', line 3

def options
  @options
end

Instance Method Details

#handle(info, message, payload) ⇒ Object



11
12
13
# File 'lib/jackrabbit/message_receiver.rb', line 11

def handle(info, message, payload)
  @handler.call Message.new(info, message, payload, channel)
end