class Jackrabbit::MessageReceiver

Attributes

channel[R]
handler[R]
options[R]

Public Class Methods

new(channel, options = {}, &block) click to toggle source
# File lib/jackrabbit/message_receiver.rb, line 5
def initialize(channel, options = {}, &block)
  @channel = channel
  @options = options
  handle_with(&block) if block_given?
end

Public Instance Methods

handle(info, message, payload) click to toggle source
# File lib/jackrabbit/message_receiver.rb, line 11
def handle(info, message, payload)
  @handler.call Message.new(info, message, payload, channel)
end

Private Instance Methods

handle_with(&block) click to toggle source
# File lib/jackrabbit/message_receiver.rb, line 17
def handle_with(&block)
  @handler = block
end