class FTW::Cookies

Based on behavior and things described in RFC6265

Public Class Methods

new() click to toggle source

A new cookies store

# File lib/ftw/cookies.rb, line 76
def initialize
  @cookies = []
end

Public Instance Methods

add(name, value=nil, attributes={}) click to toggle source

Add a cookie

# File lib/ftw/cookies.rb, line 81
def add(name, value=nil, attributes={})
  cookie = Cookie.new(name, value, attributes)
  @cookies << cookie
end
add_from_header(set_cookie_string) click to toggle source

Add a cookie from a header 'Set-Cookie' value

# File lib/ftw/cookies.rb, line 87
def add_from_header(set_cookie_string)
  cookie = Cookie.parse(set_cookie_string)
  @cookies << cookie
end
for_url(url) click to toggle source

Get cookies for a URL

# File lib/ftw/cookies.rb, line 93
def for_url(url)
  # TODO(sissel): only return cookies that are valid for the url
  return @cookies
end