Exception: LifecycleVM::VM::InvalidState

Inherits:
Error
  • Object
show all
Defined in:
lib/lifecycle_vm/vm.rb

Overview

Error raised if the machine attempts to enter a state not declared with .on

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state, vm) ⇒ InvalidState

Returns a new instance of InvalidState.

Parameters:

  • state (Symbol)

    the name of the state that does not exist

  • vm (LifecycleVM::VM)

    the vm raising the error



73
74
75
76
77
# File 'lib/lifecycle_vm/vm.rb', line 73

def initialize(state, vm)
  @state = state
  @vm = vm
  super("Invalid state transition to #{@state}. Current context #{@vm}")
end

Instance Attribute Details

#stateSymbol (readonly)

Returns the name of the state that was attempted.

Returns:

  • (Symbol)

    the name of the state that was attempted



66
67
68
# File 'lib/lifecycle_vm/vm.rb', line 66

def state
  @state
end

#vmLifecycleVM::VM (readonly)

Returns the state machine being executed.

Returns:



69
70
71
# File 'lib/lifecycle_vm/vm.rb', line 69

def vm
  @vm
end