Class StateMachine::MachineCollection
In: lib/state_machine/machine_collection.rb
Parent: Hash

Represents a collection of state machines for a class

Methods

Included Modules

Assertions

Public Instance methods

Runs one or more events in parallel on the given object. See StateMachine::InstanceMethods#fire_events for more information.

Initializes the state of each machine in the given object. This can allow states to be initialized in two groups: static and dynamic. For example:

  machines.initialize_states(object) do
    # After static state initialization, before dynamic state initialization
  end

If no block is provided, then all states will still be initialized.

Valid configuration options:

  • :static - Whether to initialize static states. If set to :force, the state will be initialized regardless of its current value. Default is :force.
  • :dynamic - Whether to initialize dynamic states. If set to :force, the state will be initialized regardless of its current value. Default is true.
  • :to - A hash to write the initialized state to instead of writing to the object. Default is to write directly to the object.

Builds the collection of transitions for all event attributes defined on the given object. This will only include events whose machine actions match the one specified.

These should only be fired as a result of the action being run.

[Validate]