class Playwright::RouteHandlerEntry

Public Class Methods

new(url, base_url, handler) click to toggle source

@param url [String] @param base_url [String|nil] @param handler [Proc]

# File lib/playwright/route_handler_entry.rb, line 6
def initialize(url, base_url, handler)
  @url_value = url
  @url_matcher = UrlMatcher.new(url, base_url: base_url)
  @handler = handler
end

Public Instance Methods

handle(route, request) click to toggle source
# File lib/playwright/route_handler_entry.rb, line 12
def handle(route, request)
  if @url_matcher.match?(request.url)
    @handler.call(route, request)
    true
  else
    false
  end
end
same_value?(url:, handler: nil) click to toggle source
# File lib/playwright/route_handler_entry.rb, line 21
def same_value?(url:, handler: nil)
  if handler
    @url_value == url && @handler == handler
  else
    @url_value == url
  end
end