From 66f37b20dd70cde4c0871bc2c0a472ecd8ef14de Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Wed, 20 Mar 2013 01:12:32 +0900 Subject: [PATCH] Rename expire to expire!, to reduce the risk of making a typo. --- lib/http/cookie.rb | 2 +- lib/http/cookie_jar/hash_store.rb | 4 ++-- test/test_http_cookie.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/http/cookie.rb b/lib/http/cookie.rb index fea518f..b8cf906 100644 --- a/lib/http/cookie.rb +++ b/lib/http/cookie.rb @@ -503,7 +503,7 @@ class HTTP::Cookie # Expires this cookie by setting the expires attribute value to a # past date. - def expire + def expire! self.expires = UNIX_EPOCH self end diff --git a/lib/http/cookie_jar/hash_store.rb b/lib/http/cookie_jar/hash_store.rb index 76a35da..9d59801 100644 --- a/lib/http/cookie_jar/hash_store.rb +++ b/lib/http/cookie_jar/hash_store.rb @@ -114,7 +114,7 @@ class HTTP::CookieJar if (debt = domain_cookies.size - HTTP::Cookie::MAX_COOKIES_PER_DOMAIN) > 0 domain_cookies.sort_by!(&:created_at) domain_cookies.slice!(0, debt).each { |cookie| - add(cookie.expire) + add(cookie.expire!) } end @@ -124,7 +124,7 @@ class HTTP::CookieJar if (debt = all_cookies.size - HTTP::Cookie::MAX_COOKIES_TOTAL) > 0 all_cookies.sort_by!(&:created_at) all_cookies.slice!(0, debt).each { |cookie| - add(cookie.expire) + add(cookie.expire!) } end diff --git a/test/test_http_cookie.rb b/test/test_http_cookie.rb index 93b3cee..f68d9e4 100644 --- a/test/test_http_cookie.rb +++ b/test/test_http_cookie.rb @@ -514,7 +514,7 @@ class TestHTTPCookie < Test::Unit::TestCase assert_equal false, cookie.expired? assert_equal true, cookie.expired?(cookie.expires + 1) assert_equal false, cookie.expired?(cookie.expires - 1) - cookie.expire + cookie.expire! assert_equal true, cookie.expired? end