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.
-
#state_machine_name ⇒ Object
readonly
Returns the value of attribute state_machine_name.
Instance Method Summary collapse
-
#initialize(object, event_name, state_machine_name, failures = []) ⇒ InvalidTransition
constructor
A new instance of InvalidTransition.
- #reasoning ⇒ Object
Constructor Details
#initialize(object, event_name, state_machine_name, failures = []) ⇒ InvalidTransition
Returns a new instance of InvalidTransition.
8 9 10 11 12 |
# 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 @state_machine_name = state_machine_name super("Event '#{event_name}' cannot transition from '#{originating_state}'.#{reasoning}") 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 |
#state_machine_name ⇒ Object (readonly)
Returns the value of attribute state_machine_name.
6 7 8 |
# File 'lib/aasm/errors.rb', line 6 def state_machine_name @state_machine_name end |
Instance Method Details
#reasoning ⇒ Object
14 15 16 |
# File 'lib/aasm/errors.rb', line 14 def reasoning " Failed callback(s): #{failures}." unless failures.empty? end |