def match_query(query)
        query ||= {}
        
        if match_event(query) && (state_requirement = match_states(query))
          state_requirement.merge(:on => event_requirement)
        end
      end
def match_query(query)
        query ||= {}
        
        if match_event(query) && (state_requirement = match_states(query))
          state_requirement.merge(:on => event_requirement)
        end
      end
Verifies that all configured requirements (event and state) match the
 given query.  If a match is found, then a hash containing the
 event/state requirements that passed will be returned; otherwise, nil.