Skip to content

Instantly share code, notes, and snippets.

@trotter
Created July 10, 2009 19:43
Show Gist options
  • Select an option

  • Save trotter/144743 to your computer and use it in GitHub Desktop.

Select an option

Save trotter/144743 to your computer and use it in GitHub Desktop.
# Convert the Cookie to its string representation.
def to_s
buf = ""
buf += @name + '='
if @value.kind_of?(String)
buf += CGI::escape(@value)
else
buf += @value.collect{|v| CGI::escape(v) }.join("&")
end
if @domain
buf += '; domain=' + @domain
end
if @path
buf += '; path=' + @path
end
if @expires
buf += '; expires=' + CGI::rfc1123_date(@expires)
end
if @secure == true
buf += '; secure'
end
buf
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment