Module: Pork::Parallel

Included in:
Executor
Defined in:
lib/pork/mode/parallel.rb

Instance Method Summary collapse

Instance Method Details

#coresObject



6
7
8
# File 'lib/pork/mode/parallel.rb', line 6

def cores
  8
end

#parallel(stat = Stat.new, paths = all_paths) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/pork/mode/parallel.rb', line 10

def parallel stat=Stat.new, paths=all_paths
  stat.prepare(paths)
  paths.shuffle.each_slice(cores).map do |paths_slice|
    Thread.new do
      execute(:shuffled,
              Stat.new(stat.reporter, stat.protected_exceptions),
              paths_slice)
    end
  end.map(&:value).inject(stat, &:merge)
end