1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Remove unnecessary constraints attribute

This commit is contained in:
Amadeus Folego 2016-07-29 16:28:27 -03:00
parent cb59b5bcf7
commit 64fa2078a1

View file

@ -43,7 +43,7 @@ module Sidekiq
end
class WebRoute
attr_accessor :request_method, :pattern, :block, :constraints, :name
attr_accessor :request_method, :pattern, :block, :name
NAMED_SEGMENTS_PATTERN = /\/([^\/]*):([^:$\/]+)/.freeze
@ -72,21 +72,7 @@ module Sidekiq
if path_match = path.match(regexp)
params = Hash[path_match.names.map(&:to_sym).zip(path_match.captures)]
params if meets_constraints(params)
end
end
def meets_constraints(params)
if constraints
constraints.each do |param, constraint|
unless params[param].to_s.match(constraint)
return false
end
end
end
true
end
end
end