Class: DevSuite::Workflow::Step::Parallel

Inherits:
Base show all
Defined in:
lib/dev_suite/workflow/step/parallel.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #next_step

Instance Method Summary collapse

Methods inherited from Base

#initialize, #next

Methods inherited from Utils::Construct::Component::Base

component_key

Constructor Details

This class inherits a constructor from DevSuite::Workflow::Step::Base

Instance Method Details

#run(context) ⇒ Object

Executes multiple tasks in parallel using threads



8
9
10
11
12
13
14
# File 'lib/dev_suite/workflow/step/parallel.rb', line 8

def run(context)
  tasks = @action.call(context)
  threads = tasks.map do |task|
    Thread.new { task.call(context) }
  end
  threads.each(&:join)
end