aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-01 22:11:52 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-01 22:11:52 +0100
commit5966b801ced62bdfcf1c8189bc068911db90ac13 (patch)
treed405f9744e60249f68c8da43144691a1f719ded5 /actionpack
parentbaae952588395a1bc04122b00a94baa5af8cdf35 (diff)
downloadrails-5966b801ced62bdfcf1c8189bc068911db90ac13.tar.gz
rails-5966b801ced62bdfcf1c8189bc068911db90ac13.tar.bz2
rails-5966b801ced62bdfcf1c8189bc068911db90ac13.zip
Simplify filter normalization.
Assume the filter is a string, if it wasn't a hash and isn't nil. Remove needless else and rely on Ruby's default nil return. Add spaces within hash braces.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/inspector.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb
index 1ca2a3b683..115ec98ea9 100644
--- a/actionpack/lib/action_dispatch/routing/inspector.rb
+++ b/actionpack/lib/action_dispatch/routing/inspector.rb
@@ -83,11 +83,9 @@ module ActionDispatch
def normalize_filter(filter)
if filter.is_a?(Hash) && filter[:controller]
- {controller: /#{filter[:controller].downcase.sub(/_?controller\z/, '').sub('::', '/')}/}
- elsif filter.is_a?(String)
- {controller: /#{filter}/, action: /#{filter}/}
- else
- nil
+ { controller: /#{filter[:controller].downcase.sub(/_?controller\z/, '').sub('::', '/')}/ }
+ elsif filter
+ { controller: /#{filter}/, action: /#{filter}/ }
end
end