class RangeScan::Matcher

Attributes

regexp[R]

Public Class Methods

new(regexp) click to toggle source
# File lib/rangescan/matcher.rb, line 7
def initialize(regexp)
  @regexp = Regexp.new(regexp)
end

Public Instance Methods

filter(results) click to toggle source
# File lib/rangescan/matcher.rb, line 11
def filter(results)
  results.select do |result|
    body = result.dig(:body) || ""
    begin
      body =~ regexp
    rescue ArgumentError, Encoding::CompatibilityError
      false
    end
  end
end