class Playwright::UrlMatcher

Public Class Methods

new(url, base_url:) click to toggle source

@param url [String|Regexp] @param base_url [String|nil]

# File lib/playwright/url_matcher.rb, line 5
def initialize(url, base_url:)
  @url = url
  @base_url = base_url
end

Public Instance Methods

match?(target_url) click to toggle source
# File lib/playwright/url_matcher.rb, line 10
def match?(target_url)
  case @url
  when String
    joined_url == target_url || File.fnmatch?(@url, target_url)
  when Regexp
    @url.match?(target_url)
  else
    false
  end
end

Private Instance Methods

joined_url() click to toggle source
# File lib/playwright/url_matcher.rb, line 21
        def joined_url
  if @base_url && !@url.start_with?('*')
    URI.join(@base_url, @url).to_s
  else
    @url
  end
end