Module: RubyReactor::StepSignals
- Included in:
- Dsl::TemplateHelpers, RubyReactor::Step::ClassMethods
- Defined in:
- lib/ruby_reactor/step_signals.rb
Overview
success! / skip! / fail! / halt! — end a step body immediately
with the matching signal, from any call depth. Mixed into both authoring
surfaces (class steps and inline run blocks) so the helpers behave
identically in either style (contracts/step-helpers.md).
Implemented as throw/catch rather than an exception: a throw passes
straight through rescue Exception while ensure blocks still run
(verified in research.md R2), so a step's own broad rescue cannot swallow
the author's intended outcome. The catching catch(StepSignals::TAG) lives
at each step-body invocation site (step_executor.rb, compensation_manager.rb).
Constant Summary collapse
- TAG =
:ruby_reactor_step_signal
Instance Method Summary collapse
- #fail!(error, **opts) ⇒ Object
- #halt!(reason: nil, **kwargs) ⇒ Object
- #skip! ⇒ Object
- #success!(value = nil) ⇒ Object
Instance Method Details
#fail!(error, **opts) ⇒ Object
25 26 27 |
# File 'lib/ruby_reactor/step_signals.rb', line 25 def fail!(error, **opts) throw TAG, RubyReactor.Failure(error, **opts) end |
#halt!(reason: nil, **kwargs) ⇒ Object
29 30 31 |
# File 'lib/ruby_reactor/step_signals.rb', line 29 def halt!(reason: nil, **kwargs) throw TAG, RubyReactor.Halt(reason: reason, **kwargs) end |
#skip! ⇒ Object
21 22 23 |
# File 'lib/ruby_reactor/step_signals.rb', line 21 def skip!(...) throw TAG, RubyReactor.Skipped(...) end |
#success!(value = nil) ⇒ Object
17 18 19 |
# File 'lib/ruby_reactor/step_signals.rb', line 17 def success!(value = nil) throw TAG, RubyReactor.Success(value) end |