Class: Servactory::Actions::Tools::Runner
- Inherits:
-
Object
- Object
- Servactory::Actions::Tools::Runner
- Defined in:
- lib/servactory/actions/tools/runner.rb
Overview
Executes service actions within stages.
## Purpose
Orchestrates the execution of service actions, handling stage wrappers, rollbacks, and conditional execution (only_if/only_unless). Provides the core execution engine for Servactory services.
## Usage
“‘ruby Runner.run!(context, collection_of_stages) “`
## Integration
Called by Servactory::Context::Callable to execute all actions defined in a service. Works with Stages::Collection and Actions::Collection.
Class Method Summary collapse
-
.run! ⇒ void
Runs the service actions.
Instance Method Summary collapse
-
#initialize(context, collection_of_stages) ⇒ Runner
constructor
Creates a new runner instance.
-
#run! ⇒ void
Executes all stages in position order.
Constructor Details
#initialize(context, collection_of_stages) ⇒ Runner
Creates a new runner instance.
38 39 40 41 |
# File 'lib/servactory/actions/tools/runner.rb', line 38 def initialize(context, collection_of_stages) @context = context @collection_of_stages = collection_of_stages end |
Class Method Details
.run! ⇒ void
This method returns an undefined value.
Runs the service actions.
30 31 32 |
# File 'lib/servactory/actions/tools/runner.rb', line 30 def self.run!(...) new(...).run! end |
Instance Method Details
#run! ⇒ void
This method returns an undefined value.
Executes all stages in position order.
Falls back to calling the service’s ‘call` method if no stages defined.
48 49 50 51 52 53 54 |
# File 'lib/servactory/actions/tools/runner.rb', line 48 def run! return use_call if @collection_of_stages.empty? @collection_of_stages.sorted_by_position.each do |stage| call_stage(stage) end end |