class CGI::Cookie
def initialize(name = "", *value)
false). HttpOnly cookies are not available to javascript.
httponly:: whether this cookie is a HttpOnly cookie or not (default to
servers.
false). Secure cookies are only transmitted to HTTPS
secure:: whether this cookie is a secure cookie or not (default to
expires:: the time at which this cookie expires, as a +Time+ object.
domain:: the domain for which this cookie applies.
the value of the +SCRIPT_NAME+ environment variable.
path:: the path for which this cookie applies. Defaults to
value:: the cookie's value or list of values.
name:: the name of the cookie. Required.
A Hash of options to initialize this Cookie. Possible options are:
+options_hash+::
value or list of values of the cookie
*value::
variable, and #secure is false.
#expiration. The #path is gleaned from the +SCRIPT_NAME+ environment
The name of the cookie; in this form, there is no #domain or
+name_string+::
Cookie.new(options_hash)
Cookie.new(name_string,*value)
:call-seq:
Create a new CGI::Cookie object.
def initialize(name = "", *value) @domain = nil @expires = nil if name.kind_of?(String) self.name = name self.path = (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "") @secure = false @httponly = false return super(value) end options = name unless options.has_key?("name") raise ArgumentError, "`name' required" end self.name = options["name"] value = Array(options["value"]) # simple support for IE self.path = options["path"] || (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "") self.domain = options["domain"] @expires = options["expires"] @secure = options["secure"] == true @httponly = options["httponly"] == true super(value) end