Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/forkit.rb

Instance Method Summary collapse

Instance Method Details

#forked(threshold = 100000) ⇒ Forkit::Enumerable

We hook into array to be able to easily handle concurrent processing of each blocks.

Examples:

Execute each in parallel.

[ 1, 2, 3, 4, 5 ].forked.each do |object|
  p object
end

Parameters:

  • threshold (Integer) (defaults to: 100000)

    The threshold where to process in a single thread.

Returns:

Since:

  • 0.1.0



21
22
23
# File 'lib/forkit.rb', line 21

def forked(threshold = 100000)
  Forkit::Enumerable.new(self, threshold)
end