Class: BunnyMock::GetResponse

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bunny_mock/get_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelBunnyMock::Channel (readonly)

Returns Channel the response is from.

Returns:



15
16
17
# File 'lib/bunny_mock/get_response.rb', line 15

def channel
  @channel
end

#queueBunnyMock::Queue (readonly)

Returns Queue the response is from.

Returns:



18
19
20
# File 'lib/bunny_mock/get_response.rb', line 18

def queue
  @queue
end

Class Method Details

.next_delivery_tagInteger

Returns incrementing numerically value to support #ack with multiple=true.

Returns:

  • (Integer)

    incrementing numerically value to support #ack with multiple=true



81
82
83
84
# File 'lib/bunny_mock/get_response.rb', line 81

def self.next_delivery_tag
  @delivery_tag ||= 0
  @delivery_tag += 1
end

Instance Method Details

#[](k) ⇒ Object

Accesses delivery properties by key

See Also:

  • Hash#[]


40
41
42
# File 'lib/bunny_mock/get_response.rb', line 40

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

#delivery_tagString

Returns Delivery identifier that is used to acknowledge, reject and nack deliveries.

Returns:

  • (String)

    Delivery identifier that is used to acknowledge, reject and nack deliveries



60
61
62
# File 'lib/bunny_mock/get_response.rb', line 60

def delivery_tag
  @hash[:delivery_tag]
end

#each(*args, &block) ⇒ Object

Iterates over the delivery properties

See Also:

  • Enumerable#each


34
35
36
# File 'lib/bunny_mock/get_response.rb', line 34

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

#exchangeString

Returns Name of the exchange this message was published to.

Returns:

  • (String)

    Name of the exchange this message was published to



71
72
73
# File 'lib/bunny_mock/get_response.rb', line 71

def exchange
  @hash[:exchange]
end

#redeliveredBoolean Also known as: redelivered?

Returns true if this delivery is a redelivery (the message was requeued at least once).

Returns:

  • (Boolean)

    true if this delivery is a redelivery (the message was requeued at least once)



65
66
67
# File 'lib/bunny_mock/get_response.rb', line 65

def redelivered
  @hash[:redelivered]
end

#routing_keyString

Returns Routing key this message was published with.

Returns:

  • (String)

    Routing key this message was published with



76
77
78
# File 'lib/bunny_mock/get_response.rb', line 76

def routing_key
  @hash[:routing_key]
end

#to_hashHash

Returns Hash representation of this delivery info.

Returns:

  • (Hash)

    Hash representation of this delivery info



45
46
47
# File 'lib/bunny_mock/get_response.rb', line 45

def to_hash
  @hash
end