mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-04-27 14:57:46 +00:00
Rename expire to expire!, to reduce the risk of making a typo.
This commit is contained in:
parent
f04714741f
commit
66f37b20dd
3 changed files with 4 additions and 4 deletions
|
|
@ -503,7 +503,7 @@ class HTTP::Cookie
|
||||||
|
|
||||||
# Expires this cookie by setting the expires attribute value to a
|
# Expires this cookie by setting the expires attribute value to a
|
||||||
# past date.
|
# past date.
|
||||||
def expire
|
def expire!
|
||||||
self.expires = UNIX_EPOCH
|
self.expires = UNIX_EPOCH
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class HTTP::CookieJar
|
||||||
if (debt = domain_cookies.size - HTTP::Cookie::MAX_COOKIES_PER_DOMAIN) > 0
|
if (debt = domain_cookies.size - HTTP::Cookie::MAX_COOKIES_PER_DOMAIN) > 0
|
||||||
domain_cookies.sort_by!(&:created_at)
|
domain_cookies.sort_by!(&:created_at)
|
||||||
domain_cookies.slice!(0, debt).each { |cookie|
|
domain_cookies.slice!(0, debt).each { |cookie|
|
||||||
add(cookie.expire)
|
add(cookie.expire!)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ class HTTP::CookieJar
|
||||||
if (debt = all_cookies.size - HTTP::Cookie::MAX_COOKIES_TOTAL) > 0
|
if (debt = all_cookies.size - HTTP::Cookie::MAX_COOKIES_TOTAL) > 0
|
||||||
all_cookies.sort_by!(&:created_at)
|
all_cookies.sort_by!(&:created_at)
|
||||||
all_cookies.slice!(0, debt).each { |cookie|
|
all_cookies.slice!(0, debt).each { |cookie|
|
||||||
add(cookie.expire)
|
add(cookie.expire!)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -514,7 +514,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
||||||
assert_equal false, cookie.expired?
|
assert_equal false, cookie.expired?
|
||||||
assert_equal true, cookie.expired?(cookie.expires + 1)
|
assert_equal true, cookie.expired?(cookie.expires + 1)
|
||||||
assert_equal false, cookie.expired?(cookie.expires - 1)
|
assert_equal false, cookie.expired?(cookie.expires - 1)
|
||||||
cookie.expire
|
cookie.expire!
|
||||||
assert_equal true, cookie.expired?
|
assert_equal true, cookie.expired?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue