Class: Cloudq::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudq/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Worker

Returns a new instance of Worker.



18
19
20
# File 'lib/cloudq/worker.rb', line 18

def initialize(*args)
  @queues = args
end

Instance Attribute Details

#queuesObject

Returns the value of attribute queues.



16
17
18
# File 'lib/cloudq/worker.rb', line 16

def queues
  @queues
end

Instance Method Details

#run(&block) ⇒ Object



22
23
24
25
26
27
# File 'lib/cloudq/worker.rb', line 22

def run(&block)
  loop do
    @queues.each { |q| Consume.new(q).job }
    yield
  end
end