class Kudzu::Agent::Util::Matcher

Public Class Methods

match?(text, allows: nil, denies: nil) click to toggle source
# File lib/kudzu/agent/util/matcher.rb, line 6
def match?(text, allows: nil, denies: nil)
  match_to_allows?(text, allows) && !match_to_denies?(text, denies)
end

Private Class Methods

match_to_allows?(text, allows) click to toggle source
# File lib/kudzu/agent/util/matcher.rb, line 12
def match_to_allows?(text, allows)
  allows = Array(allows)
  allows.empty? || allows.any? { |allow| Kudzu::Common.match?(text, allow) }
end
match_to_denies?(text, denies) click to toggle source
# File lib/kudzu/agent/util/matcher.rb, line 17
def match_to_denies?(text, denies)
  denies = Array(denies)
  !denies.empty? && denies.any? { |deny| Kudzu::Common.match?(text, deny) }
end