class Sidekiq::Web::Router::Route
Constants
- EMPTY
- NAMED_SEGMENTS_PATTERN
Attributes
Public Class Methods
Source
# File lib/sidekiq/web/router.rb, line 58 def initialize(request_method, pattern, block) @request_method = request_method @pattern = pattern @block = block end
Public Instance Methods
Source
# File lib/sidekiq/web/router.rb, line 68 def compile if pattern.match?(NAMED_SEGMENTS_PATTERN) p = pattern.gsub(NAMED_SEGMENTS_PATTERN, '/\1(?<\2>[^$/]+)') Regexp.new("\\A#{p}\\Z") else pattern end end
Source
# File lib/sidekiq/web/router.rb, line 80 def match(request_method, path) case matcher when String EMPTY if path == matcher else path_match = path.match(matcher) path_match&.named_captures&.transform_keys(&:to_sym) end end