Class StateMachine::PathCollection
In: lib/state_machine/path_collection.rb
Parent: Array

Represents a collection of paths that are generated based on a set of requirements regarding what states to start and end on

Methods

events   from_states   new   to_states  

Included Modules

Assertions

Attributes

from_name  [R]  The initial state to start each path from
machine  [R]  The state machine these path are walking
object  [R]  The object whose state machine is being walked
to_name  [R]  The target state for each path

Public Class methods

Creates a new collection of paths with the given requirements.

Configuration options:

  • :from - The initial state to start from
  • :to - The target end state
  • :deep - Whether to enable deep searches for the target state.
  • :guard - Whether to guard transitions with the if/unless conditionals defined for each one

Public Instance methods

Lists all of the events that can be fired through the paths in this collection.

For example,

  paths.events  # => [:park, :ignite, :shift_up, ...]

Lists all of the states that can be transitioned from through the paths in this collection.

For example,

  paths.from_states # => [:parked, :idling, :first_gear, ...]

Lists all of the states that can be transitioned to through the paths in this collection.

For example,

  paths.to_states # => [:idling, :first_gear, :second_gear, ...]

[Validate]