summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-06-09 14:00:22 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-06-09 14:00:22 -0700
commit5afe6b51a1bee82c1eeca98231cde9d0ba0e2469 (patch)
tree522a3d3afbdb99d6a5aaf04adfd3b90cc9015146
parent2992518e265d5c6e0539a911a5aa16dfdc3e281a (diff)
downloadrack-5afe6b51a1bee82c1eeca98231cde9d0ba0e2469.tar.gz
use `each_with_object` instead of tapping
-rw-r--r--lib/rack/utils.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb
index 963824ab..5287ddc9 100644
--- a/lib/rack/utils.rb
+++ b/lib/rack/utils.rb
@@ -189,10 +189,8 @@ module Rack
# the Cookie header such that those with more specific Path attributes
# precede those with less specific. Ordering with respect to other
# attributes (e.g., Domain) is unspecified.
- Hash[].tap do |hash|
- cookies = parse_query(env[HTTP_COOKIE], ';,') { |s| unescape(s) rescue s }
- cookies.each { |k,v| hash[k] = Array === v ? v.first : v }
- end
+ cookies = parse_query(env[HTTP_COOKIE], ';,') { |s| unescape(s) rescue s }
+ cookies.each_with_object({}) { |(k,v), hash| hash[k] = Array === v ? v.first : v }
end
module_function :parse_cookies