Skip to content

Commit

Permalink
Merge pull request #17784 from bruno-/refactor-nested-ifs
Browse files Browse the repository at this point in the history
Refactor nested if
  • Loading branch information
rafaelfranca committed Nov 26, 2014
2 parents 73a7192 + 9530c57 commit b0328ea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions actionpack/lib/action_dispatch/routing/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,10 @@ def add_request_method(via, conditions)
def app(blocks)
if to.respond_to?(:call)
Constraints.new(to, blocks, false)
elsif blocks.any?
Constraints.new(dispatcher(defaults), blocks, true)
else
if blocks.any?
Constraints.new(dispatcher(defaults), blocks, true)
else
dispatcher(defaults)
end
dispatcher(defaults)
end
end

Expand Down

0 comments on commit b0328ea

Please sign in to comment.