class FWC::Matcher

Public Class Methods

new(opts={}) click to toggle source
# File lib/fwc.rb, line 200
def initialize opts={}
  @key = opts[:key]
  @tags = opts[:tags]
end

Public Instance Methods

matches?(data) click to toggle source
# 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

  tags = d["tags"]
  return false if @tags and (@tags & (tags || [])).empty?

  true
end