class Pool
Public Class Methods
new(options)
click to toggle source
# File lib/pool.rb, line 2 def initialize(options) @min_threads = options[:threads] @queue = Queue.new @threads = [] @min_threads.times do |i| @threads << Thread.new { while true block = @queue.pop block.call end } end end
Public Instance Methods
<<(block)
click to toggle source
# File lib/pool.rb, line 16 def <<(block) @queue << block end