Class: Axn::Executor
- Inherits:
-
Object
- Object
- Axn::Executor
- Defined in:
- lib/axn/executor.rb
Overview
Executor encapsulates the full execution pipeline for an action. It owns all the wrapper logic that was previously spread across instance methods, reducing the number of methods injected into user classes.
The execution pipeline has two zones separated by the exception boundary:
**Outside zone** (result settled, must not raise):
-
nesting_tracking: manages the axn stack
-
tracing: reads result.outcome, result.elapsed_time, result.exception
-
logging: reads result.ok?, result.outcome, result.elapsed_time
Boundary:
-
exception_handling: catches exceptions, sets result state, dispatches callbacks
**Inside zone** (can raise fail!/done!):
-
timing: sets elapsed_time via ensure
-
contract: validates inputs/outputs, applies defaults/preprocessing
-
hooks: user before/after/around hooks
Instance Method Summary collapse
-
#initialize(action) ⇒ Executor
constructor
rubocop:disable Metrics/ClassLength.
- #run ⇒ Object
Constructor Details
#initialize(action) ⇒ Executor
rubocop:disable Metrics/ClassLength
23 24 25 26 27 |
# File 'lib/axn/executor.rb', line 23 def initialize(action) @action = action @action_class = action.class @context = action.instance_variable_get(:@__context) end |
Instance Method Details
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/axn/executor.rb', line 29 def run Core::NestingTracking.tracking(@action) do with_tracing do with_logging do with_timing do with_exception_handling do with_contract do with_hooks do @action.call end end end end end end end end |