Class | CGIKit::Cookie |
In: |
lib/cgikit/cookie.rb
|
Parent: | Object |
Cookie is a class for cookie. To send cookies to a browser needs to create cookie objects and set them to a response object. Instead of creating cookie objects, you can also get cookie objects from a request object.
Cookie objects have a pair of a cookie name and value. If you make the objects have multiple values for one name, you must write code by yourself.
Give arguments of initialize() a name or a pair of name/value. The value of cookie is omittable.
cookie = Cookie.new( name, value )
Request has some methods for getting cookies. The methods are cookie(key), cookies, cookie_value(key), cookie_values(key). See also Request.
Response has methods for setting cookies. These methods are defined in Message, the superclass of Response. Use add_cookie(cookie) and remove_cookie(cookie).
domain | [RW] | Domain that can receive the cookie. |
expires | [RW] | Expiry date. You set Time object to the cookie object. The value is formatted when the cookie is returned. |
name | [RW] | Name of the cookie. |
path | [RW] | Restricts the cookie in the site. |
secure | [RW] | Decides whether the cookie is encrypted or not. |
value | [RW] | Value of the cookie. |