Class: RubyReactor::Skipped
Overview
Marks a single step as skipped while the reactor continues. Behaves
exactly like Success — the value flows to dependants via result(:step) —
except skipped? is true and the step is not enrolled for rollback
(nothing happened, so there is nothing to undo).
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#step_name ⇒ Object
readonly
Returns the value of attribute step_name.
Attributes inherited from Success
Instance Method Summary collapse
-
#initialize(value = UNSET, reason: nil, step_name: nil) ⇒ Skipped
constructor
A new instance of Skipped.
- #skipped? ⇒ Boolean
Methods inherited from Success
#failure?, #halted?, #success?, #to_h
Constructor Details
#initialize(value = UNSET, reason: nil, step_name: nil) ⇒ Skipped
Returns a new instance of Skipped.
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ruby_reactor.rb', line 117 def initialize(value = UNSET, reason: nil, step_name: nil) if value.equal?(UNSET) && !reason.nil? raise ArgumentError, "RubyReactor::Skipped now marks a single step as skipped and continues. " \ "The clean halt you want is RubyReactor.Halt(reason: ...) / halt!(reason: ...)." end super(value.equal?(UNSET) ? nil : value) @reason = reason @step_name = step_name end |
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
115 116 117 |
# File 'lib/ruby_reactor.rb', line 115 def reason @reason end |
#step_name ⇒ Object (readonly)
Returns the value of attribute step_name.
115 116 117 |
# File 'lib/ruby_reactor.rb', line 115 def step_name @step_name end |
Instance Method Details
#skipped? ⇒ Boolean
129 130 131 |
# File 'lib/ruby_reactor.rb', line 129 def skipped? true end |