Exception: AASM::InvalidTransition
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- AASM::InvalidTransition
- Defined in:
- lib/aasm/errors.rb
Instance Attribute Summary collapse
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#originating_state ⇒ Object
readonly
Returns the value of attribute originating_state.
Instance Method Summary collapse
-
#initialize(object, event_name, state_machine_name, failures = []) ⇒ InvalidTransition
constructor
A new instance of InvalidTransition.
- #message ⇒ Object
- #reasoning ⇒ Object
Constructor Details
#initialize(object, event_name, state_machine_name, failures = []) ⇒ InvalidTransition
Returns a new instance of InvalidTransition.
8 9 10 |
# File 'lib/aasm/errors.rb', line 8 def initialize(object, event_name, state_machine_name, failures = []) @object, @event_name, @originating_state, @failures = object, event_name, object.aasm(state_machine_name).current_state, failures end |
Instance Attribute Details
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
6 7 8 |
# File 'lib/aasm/errors.rb', line 6 def event_name @event_name end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
6 7 8 |
# File 'lib/aasm/errors.rb', line 6 def failures @failures end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
6 7 8 |
# File 'lib/aasm/errors.rb', line 6 def object @object end |
#originating_state ⇒ Object (readonly)
Returns the value of attribute originating_state.
6 7 8 |
# File 'lib/aasm/errors.rb', line 6 def originating_state @originating_state end |
Instance Method Details
#message ⇒ Object
12 13 14 |
# File 'lib/aasm/errors.rb', line 12 def "Event '#{event_name}' cannot transition from '#{originating_state}'. #{reasoning}" end |
#reasoning ⇒ Object
16 17 18 |
# File 'lib/aasm/errors.rb', line 16 def reasoning "Failed callback(s): #{failures}." unless failures.empty? end |