In Files

  • minitest/parallel_each.rb

Parent

Methods

Included Modules

ParallelEach

This file is imported from the minitest project. DO NOT make modifications in this repo. They will be reverted! File a patch instead and assign it to Ryan Davis.

Constants

N

Public Class Methods

new(list) click to toggle source
 
               # File minitest/parallel_each.rb, line 13
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 minitest/parallel_each.rb, line 24
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 minitest/parallel_each.rb, line 20
def grep pattern
  self.class.new super
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus