Class: RubyReactor::Skipped

Inherits:
Success
  • Object
show all
Defined in:
lib/ruby_reactor.rb

Overview

A “clean halt” signal. Two ways to produce one:

1. Implicitly, when a reactor's `with_period` gate finds the bucket has
   already been claimed. The executor short-circuits before any step
   runs.

2. Explicitly, by returning `RubyReactor.Skipped(reason: "...")` from a
   step's `run` block. The reactor halts immediately — no further steps,
   and crucially **no compensation** of already-completed steps. Use this
   when a step discovers that the rest of the workflow is not needed
   (e.g. "user already opted out", "nothing to do this round") and the
   partial progress is still correct to keep.

Subclass of Success so callers that only check ‘success?` continue to work; `skipped?` distinguishes it.

Instance Attribute Summary collapse

Attributes inherited from Success

#value

Instance Method Summary collapse

Methods inherited from Success

#failure?, #success?, #to_h

Constructor Details

#initialize(reason: nil, period_key: nil, step_name: nil) ⇒ Skipped

Returns a new instance of Skipped.



75
76
77
78
79
80
# File 'lib/ruby_reactor.rb', line 75

def initialize(reason: nil, period_key: nil, step_name: nil)
  super(nil)
  @reason = reason
  @period_key = period_key
  @step_name = step_name
end

Instance Attribute Details

#period_keyObject (readonly)

Returns the value of attribute period_key.



73
74
75
# File 'lib/ruby_reactor.rb', line 73

def period_key
  @period_key
end

#reasonObject (readonly)

Returns the value of attribute reason.



73
74
75
# File 'lib/ruby_reactor.rb', line 73

def reason
  @reason
end

#step_nameObject (readonly)

Returns the value of attribute step_name.



73
74
75
# File 'lib/ruby_reactor.rb', line 73

def step_name
  @step_name
end

Instance Method Details

#skipped?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/ruby_reactor.rb', line 82

def skipped?
  true
end