Sha256: 1a28ac2795a769d590cdc32c49deefbddd1add7f9b3583da9be81b4399014724

Contents?: true

Size: 377 Bytes

Versions: 4

Compression:

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

  Executor.extend(Parallel)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pork-1.2.3 lib/pork/mode/parallel.rb
pork-1.2.2 lib/pork/mode/parallel.rb
pork-1.2.1 lib/pork/mode/parallel.rb
pork-1.2.0 lib/pork/mode/parallel.rb