diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-06-09 14:00:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-06-09 14:00:22 -0700 |
commit | 5afe6b51a1bee82c1eeca98231cde9d0ba0e2469 (patch) | |
tree | 522a3d3afbdb99d6a5aaf04adfd3b90cc9015146 | |
parent | 2992518e265d5c6e0539a911a5aa16dfdc3e281a (diff) | |
download | rack-5afe6b51a1bee82c1eeca98231cde9d0ba0e2469.tar.gz |
use `each_with_object` instead of tapping
-rw-r--r-- | lib/rack/utils.rb | 6 |
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 |