Sha256: d30b0fbcd88b95ff424f313f816a9f267969d75c5544ca26215644ce79a35bc9
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module Nitro # Encapsulates a HTTP Cookie. class Cookie attr_reader :name attr_accessor :value, :version attr_accessor :domain, :path, :secure attr_accessor :comment, :max_age def initialize(name = nil, value = nil, expires = nil) @name = name @value = value self.expires = expires @version = 0 # Netscape Cookie @path = '/' # gmosx: KEEP this! @domain = @secure = @comment = @max_age = nil @comment_url = @discard = @port = nil end # Set the cookie expiration. def expires=(t) @expires = t && (t.is_a?(Time) ? t.httpdate : t.to_s) end # When the cookie expires. def expires @expires && Time.parse(@expires) end def to_s ret = "" ret << @name << "=" << @value ret << "; " << "Version=" << @version.to_s if @version > 0 ret << "; " << "Domain=" << @domain if @domain ret << "; " << "Expires=" << @expires if @expires ret << "; " << "Max-Age=" << @max_age.to_s if @max_age ret << "; " << "Comment=" << @comment if @comment ret << "; " << "Path=" << @path if @path ret << "; " << "Secure" if @secure ret end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.41.0 | lib/nitro/cgi/cookie.rb |
nitro-0.40.0 | lib/nitro/cgi/cookie.rb |