Sha256: 0850990fd02372119eee58cfcc62cdaf7013309015569a99d08664969e61ecaf

Contents?: true

Size: 392 Bytes

Versions: 3

Compression:

Stored size: 392 Bytes

Contents

require 'pork/mode/shuffled'

module Pork
  module Parallel
    def cores
      8
    end

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

  Executor.extend(Parallel)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pork-1.4.2 lib/pork/mode/parallel.rb
pork-1.4.1 lib/pork/mode/parallel.rb
pork-1.4.0 lib/pork/mode/parallel.rb