module PartTime

Constants

NUM_WORKERS
VERSION

Public Instance Methods

queue() click to toggle source
# File lib/part_time.rb, line 21
def queue
  @queue
end
running?() click to toggle source
# File lib/part_time.rb, line 17
def running?
  workers.any?(&:on_the_clock?)
end
start(config = {}) click to toggle source
# File lib/part_time.rb, line 11
def start(config = {})
  @queue = ::Queue.new
  @workers = (config[:size] || NUM_WORKERS).times.map { Worker.new(queue) }
  @running = true
end
workers() click to toggle source
# File lib/part_time.rb, line 25
def workers
  @workers
end