Class: Localjob::Channel
- Inherits:
-
Object
- Object
- Localjob::Channel
- Defined in:
- lib/localjob/channel.rb,
lib/localjob/mock_adapter.rb,
lib/localjob/sysv_adapter.rb,
lib/localjob/linux_adapter.rb
Instance Attribute Summary collapse
-
#queues ⇒ Object
Returns the value of attribute queues.
Instance Method Summary collapse
- #<<(queue) ⇒ Object
-
#initialize(queues) ⇒ Channel
constructor
A new instance of Channel.
- #shift ⇒ Object
Constructor Details
#initialize(queues) ⇒ Channel
5 6 7 |
# File 'lib/localjob/channel.rb', line 5 def initialize(queues) @queues = [queues].flatten.map { |q| queue_from_name(q) } end |
Instance Attribute Details
#queues ⇒ Object
Returns the value of attribute queues.
3 4 5 |
# File 'lib/localjob/channel.rb', line 3 def queues @queues end |
Instance Method Details
#<<(queue) ⇒ Object
9 10 11 |
# File 'lib/localjob/channel.rb', line 9 def <<(queue) @queues << queue_from_name(queue) end |
#shift ⇒ Object
3 4 5 6 |
# File 'lib/localjob/mock_adapter.rb', line 3 def shift queue = @queues.find { |q| q.size > 0 } return queue.shift end |