Class: FWC::Matcher
- Inherits:
-
Object
- Object
- FWC::Matcher
- Defined in:
- lib/fwc.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(data) ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ Matcher
Returns a new instance of Matcher.
200 201 202 203 |
# File 'lib/fwc.rb', line 200 def initialize opts={} @key = opts[:key] @tags = opts[:tags] end |
Instance Method Details
#matches?(data) ⇒ Boolean
205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/fwc.rb', line 205 def matches? data return false unless ["event", "metric"].include? data["type"] d = data["data"] return false unless d key = d["key"] return false if @key and @key != key = d["tags"] return false if @tags and (@tags & ( || [])).empty? true end |