class Sidekiq::WebRoute
Constants
- NAMED_SEGMENTS_PATTERN
Attributes
block[RW]
name[RW]
pattern[RW]
request_method[RW]
Public Class Methods
new(request_method, pattern, block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 74 def initialize(request_method, pattern, block) @request_method = request_method @pattern = pattern @block = block end
Public Instance Methods
compile()
click to toggle source
# File lib/sidekiq/web/router.rb, line 84 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
match(request_method, path)
click to toggle source
# File lib/sidekiq/web/router.rb, line 94 def match(request_method, path) case matcher when String {} if path == matcher else path_match = path.match(matcher) path_match&.named_captures&.transform_keys(&:to_sym) end end
matcher()
click to toggle source
# File lib/sidekiq/web/router.rb, line 80 def matcher @matcher ||= compile end