Sha256: be457f40193b2f6ccd8e4ef3140413de6e0e618652c81836ae4bca18d91f3877

Contents?: true

Size: 386 Bytes

Versions: 3

Compression:

Stored size: 386 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.io), 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.3.1 lib/pork/mode/parallel.rb
pork-1.3.0 lib/pork/mode/parallel.rb
pork-1.2.4 lib/pork/mode/parallel.rb