Class CKCookie
In: lib/cgikit.rb
Parent: Object

CKCookie 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.

CKCookie 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.

Controlling cookie objects

Creating cookies

Give arguments of initialize() a name or a pair of name/value. The value of cookie is omittable.

 cookie = CKCookie.new( name, value )

Getting cookies from a request object

CKRequest has some methods for getting cookies. The methods are cookie(key), cookies, cookie_value(key), cookie_values(key). See also CKRequest.

Setting cookies to a response object

CKResponse has methods for setting cookies. These methods are defined in CKMessage, the superclass of CKResponse. Use add_cookie(cookie) and remove_cookie(cookie).

Attributes

name:Name of the cookie.
value:Value of the cookie.
path:Restricts the cookie in the site.
domain:Domain that can receive the cookie.
expires:Expiry date. You set Time object to the cookie object. The value is formatted when the cookie is returned.
secure:Decides whether the cookie is encrypted or not.
Methods
new    to_s    value=   
Attributes
:domain  [RW] 
:expires  [RW] 
:name  [RW] 
:path  [RW] 
:secure  [RW] 
:value  [RW] 
Public Class methods
new( name, value = nil )
Public Instance methods
value=( value )
to_s()