def cleanup
      @transition_map.each do |type, events_to_transition_arrays|
        events_to_transition_arrays.each do |event, transitions|
          transitions.clear
        end
      end

      @transition_map = nil
      @state_machine = nil
      @entry_actions = nil
      @exit_actions = nil
    end
def cleanup
      @transition_map.each do |type, events_to_transition_arrays|
        events_to_transition_arrays.each do |event, transitions|
          transitions.clear
        end
      end

      @transition_map = nil
      @state_machine = nil
      @entry_actions = nil
      @exit_actions = nil
    end
Cleans up references to allow easier GC.