Class: DevSuite::Workflow::Step::Parallel
- Inherits:
-
Base
- Object
- Utils::Construct::Component::Base
- Base
- DevSuite::Workflow::Step::Parallel
- Defined in:
- lib/dev_suite/workflow/step/parallel.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#run(context) ⇒ Object
Executes multiple tasks in parallel using threads.
Methods inherited from Base
Methods inherited from Utils::Construct::Component::Base
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 |