Module: ActionLogic::ActionCoordinator::ClassMethods
- Defined in:
- lib/action_logic/action_coordinator.rb
Instance Method Summary collapse
Instance Method Details
#__private__type ⇒ Object
37 38 39 |
# File 'lib/action_logic/action_coordinator.rb', line 37 def __private__type "coordinator" end |
#execute(params = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/action_logic/action_coordinator.rb', line 12 def execute(params = {}) around(params) do |execution_context| execution_context.call next_execution_context = execution_context.plan.keys.first while (next_execution_context) do execution_context.context = next_execution_context.execute(execution_context.context) next_execution_context = execution_context.plan[next_execution_context][execution_context.context.status] # From the perspective of the coordinator, the status of the context should be # :success as long as the state transition plan defines the next execution context # for a given current exection context and its resulting context state. # However, because normally a context in a state of :halted or :failure would # be considered a "breaking" state, the status of a context that is :halted or :failure # has to be reset to the default :success status only within the execution context of # the coordinator and only when the next execution context is defined within the # state transition plan. Otherwise, the context is return as is, without mutating its :status. execution_context.context.status = :success if next_execution_context end execution_context.context end end |