def inject_event_handlers
      states = @stm.instance_variable_get(:@states)
      states.each { |k, st|
        prev = st.entry_action
        st.entry_action = proc { |*args|
          on_entry_state(st.id, *args)
        }
        prev = st.exit_action
        st.exit_action = proc { |*args|
          on_exit_state(st.id, *args)
        }
      }
    end
def inject_event_handlers
      states = @stm.instance_variable_get(:@states)
      states.each { |k, st|
        prev = st.entry_action
        st.entry_action = proc { |*args|
          on_entry_state(st.id, *args)
        }
        prev = st.exit_action
        st.exit_action = proc { |*args|
          on_exit_state(st.id, *args)
        }
      }
    end
analyze the current statemachine object and inject
 event handlers where the stm can trigger the events:
 - all entry/exit events from/to each state.
 - transition events