Class: Queight::Queue
- Inherits:
-
Object
- Object
- Queight::Queue
- Defined in:
- lib/queight/queue.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#routing_patterns ⇒ Object
readonly
Returns the value of attribute routing_patterns.
Instance Method Summary collapse
- #declare(channel) ⇒ Object
- #delete(channel) ⇒ Object
-
#initialize(name, options = {}) ⇒ Queue
constructor
A new instance of Queue.
- #message_count(channel) ⇒ Object
- #purge(channel) ⇒ Object
- #queue(channel) ⇒ Object
- #subscribe(channel, options = {}) ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Queue
Returns a new instance of Queue.
3 4 5 6 7 |
# File 'lib/queight/queue.rb', line 3 def initialize(name, = {}) @name = name @routing_patterns = Array(.delete(:routing)) @queue_options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/queight/queue.rb', line 9 def name @name end |
#routing_patterns ⇒ Object (readonly)
Returns the value of attribute routing_patterns.
9 10 11 |
# File 'lib/queight/queue.rb', line 9 def routing_patterns @routing_patterns end |
Instance Method Details
#declare(channel) ⇒ Object
11 12 13 |
# File 'lib/queight/queue.rb', line 11 def declare(channel) queue(channel) end |
#delete(channel) ⇒ Object
22 23 24 |
# File 'lib/queight/queue.rb', line 22 def delete(channel) channel.queue(@name).delete end |
#message_count(channel) ⇒ Object
30 31 32 |
# File 'lib/queight/queue.rb', line 30 def (channel) queue(channel). end |
#purge(channel) ⇒ Object
34 35 36 |
# File 'lib/queight/queue.rb', line 34 def purge(channel) queue(channel).purge end |
#queue(channel) ⇒ Object
26 27 28 |
# File 'lib/queight/queue.rb', line 26 def queue(channel) channel.queue(@name, ) end |
#subscribe(channel, options = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/queight/queue.rb', line 15 def subscribe(channel, = {}) queue = queue(channel) queue.subscribe(()) do |*args| yield(channel, *args) end end |