Parent

Methods

Included Modules

ParallelEach

Constants

N

Public Class Methods

new(list) click to toggle source
# File lib/minitest/parallel_each.rb, line 7
def initialize list
  @queue = Queue.new # *sigh*... the Queue api sucks sooo much...

  list.each { |i| @queue << i }
  N.times { @queue << nil }
end

Public Instance Methods

each() click to toggle source
# File lib/minitest/parallel_each.rb, line 18
def each
  threads = N.times.map {
    Thread.new do
      Thread.current.abort_on_exception = true
      while job = @queue.pop
        yield job
      end
    end
  }
  threads.map(&:join)
end
grep(pattern) click to toggle source
# File lib/minitest/parallel_each.rb, line 14
def grep pattern
  self.class.new super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.