Module: StateMachine

Defined in:
lib/ruby-state-machine/state_machine.rb

Overview

StateMachine Simple and flexible state machine. Define a state machine with an array of states, an array of events, and one or more transition actions. A transition can be as simple as the symbol for the next state, a lambda (code) to execute. Primitive branching can also be achieved if necessary by using a “decider” instance method.

The StateMachineTest (view source) also contains examples and unit tests for most (if not all) of the available functionality.

Also see / README for examples

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: InvalidStateError, Machine

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



15
16
17
# File 'lib/ruby-state-machine/state_machine.rb', line 15

def self.included(base)
  base.extend StateMachine::ClassMethods
end