Class: BunnyHair::Channel
- Inherits:
-
Object
- Object
- BunnyHair::Channel
- Defined in:
- lib/bunny_hair/channel.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#test_exchanges ⇒ Object
readonly
Returns the value of attribute test_exchanges.
-
#test_queues ⇒ Object
readonly
Returns the value of attribute test_queues.
Instance Method Summary collapse
- #ack(*args) ⇒ Object (also: #acknowledge)
- #direct(name, options = {}) ⇒ Object
- #fanout(name, options = {}) ⇒ Object
-
#initialize(connection = BunnyHair.new) ⇒ Channel
constructor
A new instance of Channel.
- #queue(name, options = {}) ⇒ Object
- #topic(name, options = {}) ⇒ Object
Constructor Details
#initialize(connection = BunnyHair.new) ⇒ Channel
Returns a new instance of Channel.
5 6 7 8 9 |
# File 'lib/bunny_hair/channel.rb', line 5 def initialize(connection=BunnyHair.new) @connection = connection @test_queues = [] @test_exchanges = [] end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/bunny_hair/channel.rb', line 3 def connection @connection end |
#test_exchanges ⇒ Object (readonly)
Returns the value of attribute test_exchanges.
3 4 5 |
# File 'lib/bunny_hair/channel.rb', line 3 def test_exchanges @test_exchanges end |
#test_queues ⇒ Object (readonly)
Returns the value of attribute test_queues.
3 4 5 |
# File 'lib/bunny_hair/channel.rb', line 3 def test_queues @test_queues end |
Instance Method Details
#ack(*args) ⇒ Object Also known as: acknowledge
33 34 |
# File 'lib/bunny_hair/channel.rb', line 33 def ack(*args) end |
#direct(name, options = {}) ⇒ Object
29 30 31 |
# File 'lib/bunny_hair/channel.rb', line 29 def direct(name, ={}) exchange_factory(name, :direct, ) end |
#fanout(name, options = {}) ⇒ Object
25 26 27 |
# File 'lib/bunny_hair/channel.rb', line 25 def fanout(name, ={}) exchange_factory(name, :fanout, ) end |
#queue(name, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/bunny_hair/channel.rb', line 11 def queue(name, ={}) if queue = @test_queues.select {|q| q.name == name }[0] return queue end Queue.new(name, ).tap do |queue| @test_queues << queue end end |
#topic(name, options = {}) ⇒ Object
21 22 23 |
# File 'lib/bunny_hair/channel.rb', line 21 def topic(name, ={}) exchange_factory(name, :topic, ) end |