def transition(options)
      assert_valid_keys(options, :from, :to, :on, :if, :unless)
      raise ArgumentError, 'Must specify :on event' unless options[:on]
      raise ArgumentError, 'Must specify either :to or :from state' unless !options[:to] ^ !options[:from]
      
      machine.transition(options.merge(options[:to] ? {:from => state.name} : {:to => state.name}))
    end
def transition(options)
      assert_valid_keys(options, :from, :to, :on, :if, :unless)
      raise ArgumentError, 'Must specify :on event' unless options[:on]
      raise ArgumentError, 'Must specify either :to or :from state' unless !options[:to] ^ !options[:from]
      
      machine.transition(options.merge(options[:to] ? {:from => state.name} : {:to => state.name}))
    end
Creates a new context for the given state
 Creates a new transition that determines what to change the current state
 to when an event fires from this state.

 Since this transition is being defined within a state context, you do
 *not* need to specify the <tt>:from</tt> option for the transition.  For
 example:

   state_machine do
     state :parked do
       transition :to => :idling, :on => [:ignite, :shift_up]                          # Transitions to :idling
       transition :from => [:idling, :parked], :on => :park, :unless => :seatbelt_on?  # Transitions to :parked if seatbelt is off
     end
   end

 See StateMachine::Machine#transition for a description of the possible
 configurations for defining transitions.