Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/xccache/core/parallel.rb

Instance Method Summary collapse

Instance Method Details

#parallel_map(options = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/xccache/core/parallel.rb', line 4

def parallel_map(options = {})
  # By default, use in_threads (IO-bound tasks)
  default = {}
  default[:in_threads] = Parallel.processor_count unless options.key?(:in_processes)
  Parallel.map(self, { **default, **options }) { |x| yield x if block_given? }
end