diff options
author | Bruno Sutic <bruno.sutic@gmail.com> | 2014-11-26 13:28:59 +0100 |
---|---|---|
committer | Bruno Sutic <bruno.sutic@gmail.com> | 2014-11-26 13:28:59 +0100 |
commit | 9530c5786e621bcafa68a2eab3021ccd9a930e52 (patch) | |
tree | 3339de9363463a98b1f9ff50ae984c6814355ef4 | |
parent | 73a7192394ad628b91894b18f77ab31de628ba5b (diff) | |
download | rails-9530c5786e621bcafa68a2eab3021ccd9a930e52.tar.gz rails-9530c5786e621bcafa68a2eab3021ccd9a930e52.tar.bz2 rails-9530c5786e621bcafa68a2eab3021ccd9a930e52.zip |
Refactor nested if
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index be54d43172..a8be77f46d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -244,12 +244,10 @@ module ActionDispatch 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 |