未验证 提交 9530c578 编写于 作者: B Bruno Sutic

Refactor nested if

上级 73a71923
...@@ -244,12 +244,10 @@ def add_request_method(via, conditions) ...@@ -244,12 +244,10 @@ def add_request_method(via, conditions)
def app(blocks) def app(blocks)
if to.respond_to?(:call) if to.respond_to?(:call)
Constraints.new(to, blocks, false) Constraints.new(to, blocks, false)
elsif blocks.any?
Constraints.new(dispatcher(defaults), blocks, true)
else else
if blocks.any? dispatcher(defaults)
Constraints.new(dispatcher(defaults), blocks, true)
else
dispatcher(defaults)
end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册