提交 e0be37cc 编写于 作者: C Carlos Antonio da Silva

Merge pull request #8715 from goshakkk/refactor-mapper

Refactor Routing::Mapper#matches?
......@@ -26,15 +26,10 @@ def initialize(app, constraints, request)
def matches?(env)
req = @request.new(env)
@constraints.each { |constraint|
if constraint.respond_to?(:matches?) && !constraint.matches?(req)
return false
elsif constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req))
return false
end
}
return true
@constraints.none? do |constraint|
(constraint.respond_to?(:matches?) && !constraint.matches?(req)) ||
(constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req)))
end
ensure
req.reset_parameters
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册