Class: FTW::Cookies
- Inherits:
-
Object
- Object
- FTW::Cookies
- Defined in:
- lib/ftw/cookies.rb
Overview
Based on behavior and things described in RFC6265
Defined Under Namespace
Classes: Cookie
Instance Method Summary collapse
-
#add(name, value = nil, attributes = {}) ⇒ Object
Add a cookie.
-
#add_from_header(set_cookie_string) ⇒ Object
Add a cookie from a header ‘Set-Cookie’ value.
-
#for_url(url) ⇒ Object
Get cookies for a URL.
-
#initialize ⇒ Cookies
constructor
A new cookies store.
Constructor Details
#initialize ⇒ Cookies
A new cookies store
76 77 78 |
# File 'lib/ftw/cookies.rb', line 76 def initialize @cookies = [] end |
Instance Method Details
#add(name, value = nil, attributes = {}) ⇒ Object
Add a cookie
81 82 83 84 |
# File 'lib/ftw/cookies.rb', line 81 def add(name, value=nil, attributes={}) = Cookie.new(name, value, attributes) @cookies << end |
#add_from_header(set_cookie_string) ⇒ Object
Add a cookie from a header ‘Set-Cookie’ value
87 88 89 90 |
# File 'lib/ftw/cookies.rb', line 87 def add_from_header() = Cookie.parse() @cookies << end |
#for_url(url) ⇒ Object
Get cookies for a URL
93 94 95 96 |
# 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 |