diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2013-08-19 15:23:03 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2013-08-19 15:23:03 -0300 |
commit | 55360ddf7fd5f3fedc327476bf07aac3ba698e0d (patch) | |
tree | c5d368a2b6eea5abc6aca3de60d482115f316f03 | |
parent | e5945e49653e38f4df445284eafda6fa288f071b (diff) | |
download | rails-55360ddf7fd5f3fedc327476bf07aac3ba698e0d.tar.gz rails-55360ddf7fd5f3fedc327476bf07aac3ba698e0d.tar.bz2 rails-55360ddf7fd5f3fedc327476bf07aac3ba698e0d.zip |
Use each_with_object
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameters.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index ca10da702c..dcb299ed03 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -64,16 +64,14 @@ module ActionDispatch if params.has_key?(:tempfile) UploadedFile.new(params) else - new_hash = {} - params.each do |key, val| + params.each_with_object({}) do |(key, val), new_hash| 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.with_indifferent_access end else params |