diff options
author | Marcin Olichwirowicz <olichwirowicz@gmail.com> | 2015-08-13 01:00:49 +0200 |
---|---|---|
committer | Marcin Olichwirowicz <olichwirowicz@gmail.com> | 2015-08-13 01:00:49 +0200 |
commit | fc22cb88ed1972444e7e0d91a28926901d280a60 (patch) | |
tree | d1e0255dfdb8592429a582c799464a771578f945 | |
parent | 0c15b85d5d0fada21306ec6da8b2bb0470fefc68 (diff) | |
download | rails-fc22cb88ed1972444e7e0d91a28926901d280a60.tar.gz rails-fc22cb88ed1972444e7e0d91a28926901d280a60.tar.bz2 rails-fc22cb88ed1972444e7e0d91a28926901d280a60.zip |
Simplify code
Since we are always responding with an array and using `any?`, we don't
need to check if an array is empty
-rw-r--r-- | actionpack/lib/action_dispatch/http/filter_redirect.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/http/filter_redirect.rb b/actionpack/lib/action_dispatch/http/filter_redirect.rb index 6ced03ab2c..94c1f2b41f 100644 --- a/actionpack/lib/action_dispatch/http/filter_redirect.rb +++ b/actionpack/lib/action_dispatch/http/filter_redirect.rb @@ -5,8 +5,7 @@ module ActionDispatch FILTERED = '[FILTERED]'.freeze # :nodoc: def filtered_location # :nodoc: - filters = location_filter - if !filters.empty? && location_filter_match?(filters) + if location_filter_match? FILTERED else location @@ -15,7 +14,7 @@ module ActionDispatch private - def location_filter + def location_filters if request request.env['action_dispatch.redirect_filter'] || [] else @@ -23,8 +22,8 @@ module ActionDispatch end end - def location_filter_match?(filters) - filters.any? do |filter| + def location_filter_match? + location_filters.any? do |filter| if String === filter location.include?(filter) elsif Regexp === filter |