Class: GorgonBunny::ReturnInfo

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(basic_return) ⇒ ReturnInfo

API



17
18
19
20
21
22
23
24
25
# File 'lib/gorgon_bunny/lib/gorgon_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

See Also:

  • Hash#[]


35
36
37
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 35

def [](k)
  @hash[k]
end

#each(*args, &block) ⇒ Object

Iterates over the returned delivery properties

See Also:

  • Enumerable#each


29
30
31
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 29

def each(*args, &block)
  @hash.each(*args, &block)
end

#exchangeString

Returns Exchange the message was published to.

Returns:

  • (String)

    Exchange the message was published to



65
66
67
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 65

def exchange
  @basic_return.exchange
end

#inspectObject



50
51
52
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 50

def inspect
  to_hash.inspect
end

#reply_codeInteger

Returns Reply (status) code of the cause.

Returns:

  • (Integer)

    Reply (status) code of the cause



55
56
57
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 55

def reply_code
  @basic_return.reply_code
end

#reply_textInteger

Returns Reply (status) text of the cause, explaining why the message was returned.

Returns:

  • (Integer)

    Reply (status) text of the cause, explaining why the message was returned



60
61
62
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 60

def reply_text
  @basic_return.reply_text
end

#routing_keyString

Returns Routing key the message has.

Returns:

  • (String)

    Routing key the message has



70
71
72
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 70

def routing_key
  @basic_return.routing_key
end

#to_hashHash

Returns Hash representation of this returned delivery info.

Returns:

  • (Hash)

    Hash representation of this returned delivery info



40
41
42
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 40

def to_hash
  @hash
end

#to_sObject



45
46
47
# File 'lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb', line 45

def to_s
  to_hash.to_s
end