Exception: EnumMachine::InvalidTransition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine, from, to) ⇒ InvalidTransition

Returns a new instance of InvalidTransition.



19
20
21
22
23
24
# File 'lib/enum_machine.rb', line 19

def initialize(machine, from, to)
  @from = from
  @to = to
  @enum_const = machine.base_klass.const_get(machine.enum_const_name)
  super "Transition #{from.inspect} => #{to.inspect} not defined in enum_machine #{enum_const.name}"
end

Instance Attribute Details

#enum_constObject (readonly)

Returns the value of attribute enum_const.



17
18
19
# File 'lib/enum_machine.rb', line 17

def enum_const
  @enum_const
end

#fromObject (readonly)

Returns the value of attribute from.



17
18
19
# File 'lib/enum_machine.rb', line 17

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



17
18
19
# File 'lib/enum_machine.rb', line 17

def to
  @to
end