class Pork::Parallel

Public Instance Methods

cores() click to toggle source
# File lib/pork/mode/parallel.rb, line 6
def cores
  8
end
execute(stat=Stat.new, paths=isolator.all_paths) click to toggle source
# File lib/pork/mode/parallel.rb, line 10
def execute stat=Stat.new, paths=isolator.all_paths
  executor = Shuffled.new(isolator)
  stat.prepare(paths)
  paths.shuffle.each_slice(cores).map do |paths_slice|
    Thread.new do
      executor.execute(
        Stat.new(stat.reporter, stat.protected_exceptions),
        paths_slice)
    end
  end.map(&:value).inject(stat, &:merge)
end