class Array

Public Instance Methods

multithreads_each(options={}) { |n| ... } click to toggle source
# File lib/multithreads_each/array_method.rb, line 2
def multithreads_each(options={})
  threads = []
  without_joins = options[:without_joins]

  self.each do |n|
    threads << Thread.new { yield n }
  end

  threads.each { |thread| thread.join } unless without_joins
end