aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2013-08-19 15:23:03 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2013-08-19 15:23:03 -0300
commit55360ddf7fd5f3fedc327476bf07aac3ba698e0d (patch)
treec5d368a2b6eea5abc6aca3de60d482115f316f03 /actionpack/lib/action_dispatch
parente5945e49653e38f4df445284eafda6fa288f071b (diff)
downloadrails-55360ddf7fd5f3fedc327476bf07aac3ba698e0d.tar.gz
rails-55360ddf7fd5f3fedc327476bf07aac3ba698e0d.tar.bz2
rails-55360ddf7fd5f3fedc327476bf07aac3ba698e0d.zip
Use each_with_object
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb6
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