Class: Bunny::ReturnInfo
- Inherits:
-
Object
- Object
- Bunny::ReturnInfo
- Includes:
- Enumerable
- Defined in:
- lib/bunny/return_info.rb
Overview
Wraps AMQ::Protocol::Basic::Return to provide access to the delivery properties as immutable hash as well as methods.
Instance Method Summary collapse
-
#[](k) ⇒ Object
Accesses returned delivery properties by key.
-
#each(*args, &block) ⇒ Object
Iterates over the returned delivery properties.
-
#exchange ⇒ String
Exchange the message was published to.
-
#initialize(basic_return) ⇒ ReturnInfo
constructor
API.
-
#reply_code ⇒ Integer
Reply (status) code of the cause.
-
#reply_text ⇒ Integer
Reply (status) text of the cause, explaining why the message was returned.
-
#routing_key ⇒ String
Routing key the message has.
-
#to_hash ⇒ Hash
Hash representation of this returned delivery info.
Constructor Details
#initialize(basic_return) ⇒ ReturnInfo
API
17 18 19 20 21 22 23 24 25 |
# 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 |
Instance Method Details
#[](k) ⇒ Object
Accesses returned delivery properties by key
35 36 37 |
# File 'lib/bunny/return_info.rb', line 35 def [](k) @hash[k] end |
#each(*args, &block) ⇒ Object
Iterates over the returned delivery properties
29 30 31 |
# File 'lib/bunny/return_info.rb', line 29 def each(*args, &block) @hash.each(*args, &block) end |
#exchange ⇒ String
Returns Exchange the message was published to
65 66 67 |
# File 'lib/bunny/return_info.rb', line 65 def exchange @basic_return.exchange end |
#reply_code ⇒ Integer
Returns Reply (status) code of the cause
55 56 57 |
# File 'lib/bunny/return_info.rb', line 55 def reply_code @basic_return.reply_code end |
#reply_text ⇒ Integer
Returns Reply (status) text of the cause, explaining why the message was returned
60 61 62 |
# File 'lib/bunny/return_info.rb', line 60 def reply_text @basic_return.reply_text end |
#routing_key ⇒ String
Returns Routing key the message has
70 71 72 |
# File 'lib/bunny/return_info.rb', line 70 def routing_key @basic_return.routing_key end |
#to_hash ⇒ Hash
Returns Hash representation of this returned delivery info
40 41 42 |
# File 'lib/bunny/return_info.rb', line 40 def to_hash @hash end |