Class: Hecks::Bluebook::Saga

Inherits:
Struct
  • Object
show all
Defined in:
lib/hecks/bluebook/process_manager.rb

Overview

The compensation half of a procedure, as its own thing.

A PROCESS MANAGER coordinates: legs, states, an opinion about who goes next. A SAGA undoes: what makes the world good again when a leg it dispatched is refused. Two concepts, and the industry slurs them into one word — so here they are two objects, and a procedure either has a saga or does not.

undoes is the ordered list of commands the compensation sends. Today that order is the AUTHOR's, written by hand in one on :refused leg, and the runtime does not know which legs actually completed. When compensation moves beside each dispatch — reverses on the step it reverses — this is where the completed ones, newest first, will live. The shape is already right for it; only the source of the order changes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#from_stateObject

Returns the value of attribute from_state

Returns:

  • (Object)

    the current value of from_state



44
45
46
# File 'lib/hecks/bluebook/process_manager.rb', line 44

def from_state
  @from_state
end

#reversalsObject

Returns the value of attribute reversals

Returns:

  • (Object)

    the current value of reversals



44
45
46
# File 'lib/hecks/bluebook/process_manager.rb', line 44

def reversals
  @reversals
end

#to_stateObject

Returns the value of attribute to_state

Returns:

  • (Object)

    the current value of to_state



44
45
46
# File 'lib/hecks/bluebook/process_manager.rb', line 44

def to_state
  @to_state
end

#triggerObject

Returns the value of attribute trigger

Returns:

  • (Object)

    the current value of trigger



44
45
46
# File 'lib/hecks/bluebook/process_manager.rb', line 44

def trigger
  @trigger
end

Instance Method Details

#to_sObject



47
# File 'lib/hecks/bluebook/process_manager.rb', line 47

def to_s = "#{trigger}#{to_state} (#{undoes.join(', ')})"

#undoesObject



45
# File 'lib/hecks/bluebook/process_manager.rb', line 45

def undoes = reversals.map(&:command_name)