Class Mechanize::Cookie
In: lib/mechanize/cookie.rb
Parent: Object

This class is used to represent an HTTP Cookie.

Methods

External Aliases

for_domain -> for_domain?
domain= -> set_domain
secure -> secure?

Attributes

accessed_at  [RW] 
comment  [RW] 
created_at  [RW] 
domain  [RW] 
for_domain  [RW]  If this flag is true, this cookie will be sent to any host in the domain. If it is false, this cookie will be sent only to the host indicated by the domain.
max_age  [RW] 
name  [R] 
path  [RW] 
secure  [RW] 
session  [RW] 
value  [RW] 
version  [RW] 

Public Class methods

Creates a cookie object. For each key of attr_hash, the setter is called if defined. Each key can be either a symbol or a string, downcased or not.

e.g.

    new("uid", "a12345")
    new("uid", "a12345", :domain => 'example.org',
                         :for_domain => true, :expired => Time.now + 7*86400)
    new("name" => "uid", "value" => "a12345", "Domain" => 'www.example.org')

Parses a Set-Cookie header line str sent from uri into an array of Cookie objects. Note that this array may contain nil‘s when some of the cookie-pairs are malformed.

Public Instance methods

Sets the domain attribute. A leading dot in domain implies turning the +for_domain?+ flag on.

[Validate]