Module: DeadFinder::UrlPatternMatcher

Defined in:
lib/deadfinder/url_pattern_matcher.rb

Overview

URL pattern matcher module

Class Method Summary collapse

Class Method Details

.ignore?(url, pattern) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/deadfinder/url_pattern_matcher.rb', line 14

def self.ignore?(url, pattern)
  Timeout.timeout(1) { Regexp.new(pattern).match?(url) }
rescue Timeout::Error
  false
end

.match?(url, pattern) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/deadfinder/url_pattern_matcher.rb', line 8

def self.match?(url, pattern)
  Timeout.timeout(1) { Regexp.new(pattern).match?(url) }
rescue Timeout::Error
  false
end