From 5afe6b51a1bee82c1eeca98231cde9d0ba0e2469 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 9 Jun 2015 14:00:22 -0700 Subject: use `each_with_object` instead of tapping --- lib/rack/utils.rb | 6 ++---- 1 file 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 -- cgit v1.2.1