class TaskBag::Worker

Public Class Methods

new(bag) click to toggle source
# File lib/taskbag/worker.rb, line 3
def initialize(bag)
  @bag = bag
end
start(bag) click to toggle source
# File lib/taskbag/worker.rb, line 7
def self.start(bag)
  Worker.new(bag).start
end

Public Instance Methods

start() click to toggle source
# File lib/taskbag/worker.rb, line 11
def start
  until @bag.closed?
    job = @bag.next
    (sleep(1) and next) if job.nil?

    job.run
  end
end