Improve comments.

This commit is contained in:
Akinori MUSHA 2013-03-19 20:38:25 +09:00
parent ceea67add9
commit 1c7b660c85

View file

@ -261,6 +261,8 @@ class HTTP::Cookie
cookie.httponly ||= false cookie.httponly ||= false
# RFC 6265 4.1.2.2 # RFC 6265 4.1.2.2
# The Max-Age attribute has precedence over the Expires
# attribute.
cookie.expires = date + cookie.max_age if cookie.max_age cookie.expires = date + cookie.max_age if cookie.max_age
cookie.session = !cookie.expires cookie.session = !cookie.expires
@ -281,6 +283,7 @@ class HTTP::Cookie
end end
end end
# Sets the cookie name.
def name=(name) def name=(name)
if name.nil? || name.empty? if name.nil? || name.empty?
raise ArgumentError, "cookie name cannot be empty" raise ArgumentError, "cookie name cannot be empty"
@ -316,7 +319,7 @@ class HTTP::Cookie
raise NoMethodError, 'HTTP::Cookie equivalent for Mechanize::CookieJar#set_domain() is #domain=().' raise NoMethodError, 'HTTP::Cookie equivalent for Mechanize::CookieJar#set_domain() is #domain=().'
end end
# Sets the path attribute. # Sets the path attribute value.
def path=(path) def path=(path)
@path = HTTP::Cookie.normalize_path(path) @path = HTTP::Cookie.normalize_path(path)
end end
@ -334,7 +337,7 @@ class HTTP::Cookie
@origin = origin @origin = origin
end end
# Sets the expires attribute. A `Time` object, a string # Sets the expires attribute value. A `Time` object, a string
# representation of date/time, and `nil` are good values to set. # representation of date/time, and `nil` are good values to set.
def expires=(t) def expires=(t)
case t case t