diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-08-12 20:15:37 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-08-12 20:15:37 -0300 |
commit | 7d4ad74ce594b8092f5782f51361a1fb9f64b8ad (patch) | |
tree | cdc1b7ca7e6b674a5e96a5ff89b25fe574bb38cc /actionpack/lib | |
parent | 2a05a72e6a2ff8b7e931b7849e2482f376a57a36 (diff) | |
parent | fc22cb88ed1972444e7e0d91a28926901d280a60 (diff) | |
download | rails-7d4ad74ce594b8092f5782f51361a1fb9f64b8ad.tar.gz rails-7d4ad74ce594b8092f5782f51361a1fb9f64b8ad.tar.bz2 rails-7d4ad74ce594b8092f5782f51361a1fb9f64b8ad.zip |
Merge pull request #21214 from rodzyn/fewer_objects_and_refactoring
Fewer objects and refactoring
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/filter_redirect.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/http/filter_redirect.rb b/actionpack/lib/action_dispatch/http/filter_redirect.rb index bf79963351..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,12 +22,12 @@ 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 - location.match(filter) + location =~ filter end end end |