Class: RSMP::StatusQuery
- Defined in:
- lib/rsmp/collect/status_query.rb
Overview
Match a specific status response or update
Instance Attribute Summary
Attributes inherited from Query
Instance Method Summary collapse
-
#match?(item) ⇒ Boolean
Match a status value against a query.
Methods inherited from Query
#done?, #forget, #initialize, #keep, #perform_match
Constructor Details
This class inherits a constructor from RSMP::Query
Instance Method Details
#match?(item) ⇒ Boolean
Match a status value against a query
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rsmp/collect/status_query.rb', line 5 def match? item return nil if @want['sCI'] && @want['sCI'] != item['sCI'] return nil if @want['cO'] && @want['cO'] != item['cO'] return nil if @want['n'] && @want['n'] != item['n'] return false if @want['q'] && @want['q'] != item['q'] if @want['s'].is_a? Regexp return false if item['s'] !~ @want['s'] elsif @want['s'] return false if item['s'] != @want['s'] end true end |