Class: ActiveSupport::Testing::ParallelizeExecutor

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/testing/parallelize_executor.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold) ⇒ ParallelizeExecutor

Returns a new instance of ParallelizeExecutor.


8
9
10
11
12
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 8

def initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold)
  @size = size
  @parallelize_with = with
  @threshold = threshold
end

Instance Attribute Details

#parallelize_withObject (readonly)

Returns the value of attribute parallelize_with.


6
7
8
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6

def parallelize_with
  @parallelize_with
end

#sizeObject (readonly)

Returns the value of attribute size.


6
7
8
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6

def size
  @size
end

#thresholdObject (readonly)

Returns the value of attribute threshold.


6
7
8
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6

def threshold
  @threshold
end

Instance Method Details

#<<(work) ⇒ Object


21
22
23
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 21

def <<(work)
  parallel_executor << work if parallelized?
end

#shutdownObject


25
26
27
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 25

def shutdown
  parallel_executor.shutdown if parallelized?
end

#startObject


14
15
16
17
18
19
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 14

def start
  parallelize if should_parallelize?
  show_execution_info

  parallel_executor.start if parallelized?
end