diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2013-06-04 13:34:43 +0300 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2013-06-04 13:42:40 +0300 |
commit | 998d03fddbb64698d2d813eabb5df9d58c5df386 (patch) | |
tree | 44e595c6207e804bde770d41b002f3864a66393a /actionpack/lib/action_dispatch/http | |
parent | c2f3efffd905f8f21eb5ea88687b738fe8a119a2 (diff) | |
download | rails-998d03fddbb64698d2d813eabb5df9d58c5df386.tar.gz rails-998d03fddbb64698d2d813eabb5df9d58c5df386.tar.bz2 rails-998d03fddbb64698d2d813eabb5df9d58c5df386.zip |
Refactor ActionDispatch::Http::Parameters#normalize_encode_params
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameters.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 20c24ddd85..8e992070f1 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -64,17 +64,13 @@ module ActionDispatch end new_hash = {} - params.each do |k, v| - new_key = k.is_a?(String) ? k.dup.force_encoding(Encoding::UTF_8).encode! : k - new_hash[new_key] = - case v - when Hash - normalize_encode_params(v) - when Array - v.map! {|el| normalize_encode_params(el) } - else - normalize_encode_params(v) - end + params.each do |key, val| + new_key = key.is_a?(String) ? key.dup.force_encoding(Encoding::UTF_8).encode! : key + new_hash[new_key] = if val.is_a?(Array) + val.map! { |el| normalize_encode_params(el) } + else + normalize_encode_params(val) + end end new_hash.with_indifferent_access end |