# File lib/parallel.rb, line 8 def self.in_threads(options={:count => 2}) count, options = extract_count_from_options(options) out = [] threads = [] count.times do |i| threads[i] = Thread.new do out[i] = yield(i) end end wait_for_threads(threads) out end