Class: Localjob::Channel

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#queuesObject

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

#shiftObject



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