class Bunny::ReturnInfo

Wraps AMQ::Protocol::Basic::Return to provide access to the delivery properties as immutable hash as well as methods.

Public Class Methods

new(basic_return) click to toggle source

API

# File lib/bunny/return_info.rb, line 17
def initialize(basic_return)
  @basic_return = basic_return
  @hash          = {
    :reply_code   => basic_return.reply_code,
    :reply_text   => basic_return.reply_text,
    :exchange     => basic_return.exchange,
    :routing_key  => basic_return.routing_key
  }
end

Public Instance Methods

[](k) click to toggle source

Accesses returned delivery properties by key @see Hash#[]

# File lib/bunny/return_info.rb, line 35
def [](k)
  @hash[k]
end
each(*args, &block) click to toggle source

Iterates over the returned delivery properties @see Enumerable#each

# File lib/bunny/return_info.rb, line 29
def each(*args, &block)
  @hash.each(*args, &block)
end
exchange() click to toggle source

@return [String] Exchange the message was published to

# File lib/bunny/return_info.rb, line 65
def exchange
  @basic_return.exchange
end
inspect() click to toggle source

@private

# File lib/bunny/return_info.rb, line 50
def inspect
  to_hash.inspect
end
reply_code() click to toggle source

@return [Integer] Reply (status) code of the cause

# File lib/bunny/return_info.rb, line 55
def reply_code
  @basic_return.reply_code
end
reply_text() click to toggle source

@return [Integer] Reply (status) text of the cause, explaining why the message was returned

# File lib/bunny/return_info.rb, line 60
def reply_text
  @basic_return.reply_text
end
routing_key() click to toggle source

@return [String] Routing key the message has

# File lib/bunny/return_info.rb, line 70
def routing_key
  @basic_return.routing_key
end
to_hash() click to toggle source

@return [Hash] Hash representation of this returned delivery info

# File lib/bunny/return_info.rb, line 40
def to_hash
  @hash
end
to_s() click to toggle source

@private

# File lib/bunny/return_info.rb, line 45
def to_s
  to_hash.to_s
end