module Chaintown

This module add ability to define chain of steps which will be called in order. Every step is a method in the class which include this module. Every class receive state and immutable params.

State is used to keep information which will be shared between steps. State should inherit from Chaintown::State. Steps are calls only when state is valid in other case invocation is stopped and moved to run steps defined as failed.

We can add conditions to step by using if parameter. We can also nest steps.

Example:

step :step1
step :step2, if: proc { |state, params| params[:run_step_2] }
step :step3 do
  step :step4
end
failed_step :step5

This module add DLS for defininig steps or failed_steps. All steps are of type Chaintown::Step.

Constants

VERSION