Exception: StateMachines::InvalidTransition
- Defined in:
- lib/state_machines/error.rb
Overview
An invalid transition was attempted
Instance Attribute Summary collapse
- 
  
    
      #from  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The current state value for the machine. 
- 
  
    
      #machine  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The machine attempting to be transitioned. 
Attributes inherited from Error
Instance Method Summary collapse
- 
  
    
      #event  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The event that triggered the failed transition. 
- 
  
    
      #from_name  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The name for the current state. 
- 
  
    
      #initialize(object, machine, event)  ⇒ InvalidTransition 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    :nodoc:. 
- 
  
    
      #qualified_event  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The fully-qualified name of the event that triggered the failed transition. 
- 
  
    
      #qualified_from_name  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The fully-qualified name for the current state. 
Constructor Details
#initialize(object, machine, event) ⇒ InvalidTransition
:nodoc:
| 67 68 69 70 71 72 73 74 75 76 77 | # File 'lib/state_machines/error.rb', line 67 def initialize(object, machine, event) # :nodoc: @machine = machine @from_state = machine.states.match!(object) @from = machine.read(object, :state) @event = machine.events.fetch(event) errors = machine.errors_for(object) = "Cannot transition #{machine.name} via :#{self.event} from #{from_name.inspect}" << " (Reason(s): #{errors})" unless errors.empty? super(object, ) end | 
Instance Attribute Details
#from ⇒ Object (readonly)
The current state value for the machine
| 65 66 67 | # File 'lib/state_machines/error.rb', line 65 def from @from end | 
#machine ⇒ Object (readonly)
The machine attempting to be transitioned
| 62 63 64 | # File 'lib/state_machines/error.rb', line 62 def machine @machine end | 
Instance Method Details
#event ⇒ Object
The event that triggered the failed transition
| 80 81 82 | # File 'lib/state_machines/error.rb', line 80 def event @event.name end | 
#from_name ⇒ Object
The name for the current state
| 90 91 92 | # File 'lib/state_machines/error.rb', line 90 def from_name @from_state.name end | 
#qualified_event ⇒ Object
The fully-qualified name of the event that triggered the failed transition
| 85 86 87 | # File 'lib/state_machines/error.rb', line 85 def qualified_event @event.qualified_name end | 
#qualified_from_name ⇒ Object
The fully-qualified name for the current state
| 95 96 97 | # File 'lib/state_machines/error.rb', line 95 def qualified_from_name @from_state.qualified_name end |