mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
HTTP::CookieJar#cleanup: Use delete_if.
This commit is contained in:
parent
b7254599bd
commit
7c5ac21d0f
1 changed files with 4 additions and 5 deletions
|
|
@ -167,11 +167,10 @@ class HTTP::CookieJar
|
|||
# Remove expired cookies and return self.
|
||||
def cleanup session = false
|
||||
@jar.each do |domain, paths|
|
||||
paths.each do |path, names|
|
||||
names.each do |cookie_name, cookie|
|
||||
paths[path].delete(cookie_name) if
|
||||
cookie.expired? or (session and cookie.session)
|
||||
end
|
||||
paths.each do |path, hash|
|
||||
hash.delete_if { |cookie_name, cookie|
|
||||
cookie.expired? or (session and cookie.session)
|
||||
}
|
||||
end
|
||||
end
|
||||
self
|
||||
|
|
|
|||
Loading…
Reference in a new issue