Class: RSMP::AlarmMatcher

Inherits:
Matcher
  • Object
show all
Defined in:
lib/rsmp/collect/alarm_matcher.rb

Overview

Match a specific alarm

Instance Attribute Summary

Attributes inherited from Matcher

#got, #message, #want

Instance Method Summary collapse

Methods inherited from Matcher

#done?, #forget, #initialize, #keep, #perform_match

Constructor Details

This class inherits a constructor from RSMP::Matcher

Instance Method Details

#match?(item) ⇒ Boolean

Returns:

  • (Boolean)


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

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