Class: HTTPI::CookieStore
- Inherits:
-
Object
- Object
- HTTPI::CookieStore
- Defined in:
- lib/httpi/cookie_store.rb
Overview
Instance Method Summary collapse
-
#add(*cookies) ⇒ Object
Adds one or more cookies to the store.
-
#fetch ⇒ Object
Returns the names and values for the “Cookie” header.
-
#initialize ⇒ CookieStore
constructor
A new instance of CookieStore.
Constructor Details
#initialize ⇒ CookieStore
Returns a new instance of CookieStore.
17 18 19 |
# File 'lib/httpi/cookie_store.rb', line 17 def initialize @cookies = {} end |
Instance Method Details
#add(*cookies) ⇒ Object
Adds one or more cookies to the store.
22 23 24 25 26 |
# File 'lib/httpi/cookie_store.rb', line 22 def add(*) .each do || @cookies[.name] = .name_and_value end end |
#fetch ⇒ Object
Returns the names and values for the “Cookie” header.
29 30 31 |
# File 'lib/httpi/cookie_store.rb', line 29 def fetch @cookies.values.join(";") unless @cookies.empty? end |