class Object

Public Instance Methods

in_threads(thread_count = 10, &block) click to toggle source

Run enumerable method blocks in threads

urls.in_threads.map do |url|
  url.fetch
end

Specify number of threads to use:

files.in_threads(4).all? do |file|
  file.valid?
end

Passing block runs it against `each`

urls.in_threads.each{ ... }

is same as

urls.in_threads{ ... }
# File lib/in_threads.rb, line 26
def in_threads(thread_count = 10, &block)
  InThreads.new(self, thread_count, &block)
end