Class: HTTPI::Cookie
- Inherits:
-
Object
- Object
- HTTPI::Cookie
- Defined in:
- lib/httpi/cookie.rb
Overview
Class Method Summary collapse
-
.list_from_headers(headers) ⇒ Object
Returns a list of cookies from a Hash of
headers
.
Instance Method Summary collapse
-
#initialize(cookie) ⇒ Cookie
constructor
A new instance of Cookie.
-
#name ⇒ Object
Returns the name of the cookie.
-
#name_and_value ⇒ Object
Returns the name and value of the cookie.
Constructor Details
#initialize(cookie) ⇒ Cookie
Returns a new instance of Cookie.
20 21 22 |
# File 'lib/httpi/cookie.rb', line 20 def initialize() @cookie = end |
Class Method Details
.list_from_headers(headers) ⇒ Object
Returns a list of cookies from a Hash of headers
.
16 17 18 |
# File 'lib/httpi/cookie.rb', line 16 def self.list_from_headers(headers) Array(headers["Set-Cookie"]).map { || new() } end |
Instance Method Details
#name ⇒ Object
Returns the name of the cookie.
25 26 27 |
# File 'lib/httpi/cookie.rb', line 25 def name @cookie.split("=").first end |
#name_and_value ⇒ Object
Returns the name and value of the cookie.
30 31 32 |
# File 'lib/httpi/cookie.rb', line 30 def name_and_value @cookie.split(";").first end |