Sha256: 3a5b89cf037d291e5238cc4737f230fef5f560373b69b13c0219adeeea26a857

Contents?: true

Size: 455 Bytes

Versions: 2

Compression:

Stored size: 455 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, stat.protected_exceptions),
                  paths_slice)
        end
      end.map(&:value).inject(stat, &:merge)
    end
  end

  Executor.extend(Parallel)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pork-1.4.4 lib/pork/mode/parallel.rb
pork-1.4.3 lib/pork/mode/parallel.rb