Exception: EnumMachine::InvalidTransition
- Defined in:
- lib/enum_machine.rb
Instance Attribute Summary collapse
-
#enum_const ⇒ Object
readonly
Returns the value of attribute enum_const.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(machine, from, to) ⇒ InvalidTransition
constructor
A new instance of InvalidTransition.
Constructor Details
#initialize(machine, from, to) ⇒ InvalidTransition
Returns a new instance of InvalidTransition.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/enum_machine.rb', line 17 def initialize(machine, from, to) @from = from @to = to @enum_const = begin machine.base_klass.const_get(machine.enum_const_name) rescue NameError # rubocop:disable Lint/SuppressedException end super("Transition #{from.inspect} => #{to.inspect} not defined in enum_machine :#{machine.attr_name}") end |
Instance Attribute Details
#enum_const ⇒ Object (readonly)
Returns the value of attribute enum_const.
15 16 17 |
# File 'lib/enum_machine.rb', line 15 def enum_const @enum_const end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
15 16 17 |
# File 'lib/enum_machine.rb', line 15 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
15 16 17 |
# File 'lib/enum_machine.rb', line 15 def to @to end |