Class: RSMP::AlarmQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/rsmp/collect/alarm_query.rb

Overview

Match a specific alarm

Instance Attribute Summary

Attributes inherited from Query

#got, #message, #want

Instance Method Summary collapse

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 an alarm value against a query

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/rsmp/collect/alarm_query.rb', line 5

def match? item
  return false if @want['n'] && @want['n'] != item['n']
  if @want['v'].is_a? Regexp
    return false if item['v'] !~ @want['v']
  elsif @want['v']
    return false if item['v'] != @want['v']
  end
  true
end