Method: StateMachines::Path#initialize

Defined in:
lib/state_machines/path.rb

#initialize(object, machine, options = {}) ⇒ Path

Creates a new transition path for the given object. Initially this is an empty path. In order to start walking the path, it must be populated with an initial transition.

Configuration options:

  • :target - The target state to end the path on

  • :guard - Whether to guard transitions with the if/unless conditionals defined for each one



24
25
26
27
28
29
30
31
# File 'lib/state_machines/path.rb', line 24

def initialize(object, machine, options = {})
  StateMachines::OptionsValidator.assert_valid_keys!(options, :target, :guard)

  @object = object
  @machine = machine
  @target = options[:target]
  @guard = options[:guard]
end