Exception: LiteState::TransitionError
- Defined in:
- lib/lite_state.rb
Overview
Raised when an invalid transition is attempted
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(record:, to:, from:, event:) ⇒ TransitionError
constructor
A new instance of TransitionError.
Constructor Details
#initialize(record:, to:, from:, event:) ⇒ TransitionError
Returns a new instance of TransitionError.
63 64 65 66 67 68 69 |
# File 'lib/lite_state.rb', line 63 def initialize(record:, to:, from:, event:) @record = record @to = to @from = from @event = event super("Invalid transition: #{record.class} ##{record.id} from #{from.inspect} -> #{to.inspect} on #{event}") end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
57 58 59 |
# File 'lib/lite_state.rb', line 57 def event @event end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
57 58 59 |
# File 'lib/lite_state.rb', line 57 def from @from end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
57 58 59 |
# File 'lib/lite_state.rb', line 57 def record @record end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
57 58 59 |
# File 'lib/lite_state.rb', line 57 def to @to end |