Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/duke.rb,
lib/concurrently.rb

Instance Method Summary collapse

Instance Method Details

#concurrently(threshold = 100000) ⇒ Duke::Enumerable

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

Examples:

Execute each concurrently.

[ 1, 2, 3, 4, 5 ].concurrently.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/duke.rb', line 21

def concurrently(threshold = 100000)
  Duke::Enumerable.new(self, threshold)
end