Class: RMonitor::Matcher
- Inherits:
-
Object
- Object
- RMonitor::Matcher
- Defined in:
- lib/rmonitor/matcher.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Matcher
constructor
A new instance of Matcher.
- #invokable?(profile) ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Matcher
Returns a new instance of Matcher.
3 4 5 |
# File 'lib/rmonitor/matcher.rb', line 3 def initialize( = {}) @capabilities = [:capabilities] || Capabilities.new().parse end |
Instance Method Details
#invokable?(profile) ⇒ Boolean
7 8 9 10 11 12 13 14 |
# File 'lib/rmonitor/matcher.rb', line 7 def invokable?(profile) return false if profile.has_key?(:only_if) && !profile[:only_if].call return false if profile.has_key?(:not_if) && profile[:not_if].call profile[:devices].all? do |device| has_desired_capability? device end end |