diff options
author | Matthew Draper <matthew@trebex.net> | 2018-08-15 03:01:05 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-15 03:01:05 +0930 |
commit | 7fa2f539fa2a7a1ebb5086023091983ce0d810d9 (patch) | |
tree | edb47a67fd44ab9a6fad7a38239094f2146fdad9 /actionpack | |
parent | ffc4703f22888dce0394fe0ab524a9e6cdc3c7e5 (diff) | |
parent | b71abb3bb8cd177d1d3fceec88f54b505d616887 (diff) | |
download | rails-7fa2f539fa2a7a1ebb5086023091983ce0d810d9.tar.gz rails-7fa2f539fa2a7a1ebb5086023091983ce0d810d9.tar.bz2 rails-7fa2f539fa2a7a1ebb5086023091983ce0d810d9.zip |
Merge pull request #33137 from bogdanvlviv/add-array-extract-method
Add `Array#extract!`
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameter_filter.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameter_filter.rb b/actionpack/lib/action_dispatch/http/parameter_filter.rb index 1d58964862..de11939fa8 100644 --- a/actionpack/lib/action_dispatch/http/parameter_filter.rb +++ b/actionpack/lib/action_dispatch/http/parameter_filter.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/core_ext/object/duplicable" +require "active_support/core_ext/array/extract" module ActionDispatch module Http @@ -38,8 +39,8 @@ module ActionDispatch end end - deep_regexps, regexps = regexps.partition { |r| r.to_s.include?("\\.".freeze) } - deep_strings, strings = strings.partition { |s| s.include?("\\.".freeze) } + deep_regexps = regexps.extract! { |r| r.to_s.include?("\\.".freeze) } + deep_strings = strings.extract! { |s| s.include?("\\.".freeze) } regexps << Regexp.new(strings.join("|".freeze), true) unless strings.empty? deep_regexps << Regexp.new(deep_strings.join("|".freeze), true) unless deep_strings.empty? |