# File lib/state_machine/machine.rb, line 1606
      def define_event_helpers
        # Gets the events that are allowed to fire on the current object
        define_helper(:instance, attribute(:events)) do |machine, object, *args|
          machine.events.valid_for(object, *args).map {|event| event.name}
        end
        
        # Gets the next possible transitions that can be run on the current
        # object
        define_helper(:instance, attribute(:transitions)) do |machine, object, *args|
          machine.events.transitions_for(object, *args)
        end
        
        # Add helpers for tracking the event / transition to invoke when the
        # action is called
        if action
          event_attribute = attribute(:event)
          define_helper(:instance, event_attribute) do |machine, object|
            # Interpret non-blank events as present
            event = machine.read(object, :event, true)
            event && !(event.respond_to?(:empty?) && event.empty?) ? event.to_sym : nil
          end
          
          # A roundabout way of writing the attribute is used here so that
          # integrations can hook into this modification
          define_helper(:instance, "#{event_attribute}=") do |machine, object, value|
            machine.write(object, :event, value, true)
          end
          
          event_transition_attribute = attribute(:event_transition)
          define_helper :instance, "protected; attr_accessor \#{event_transition_attribute.inspect}\n", __FILE__, __LINE__ + 1
        end
      end