# File lib/rack/test/cookie_jar.rb, line 151 def hash_for(uri = nil) cookies = {} # The cookies are sorted by most specific first. So, we loop through # all the cookies in order and add it to a hash by cookie name if # the cookie can be sent to the current URI. It's added to the hash # so that when we are done, the cookies will be unique by name and # we'll have grabbed the most specific to the URI. @cookies.each do |cookie| cookies[cookie.name] = cookie if cookie.matches?(uri) end return cookies end