Class: Wpxf::Net::CookieJar
- Inherits:
-
Hash
- Object
- Hash
- Wpxf::Net::CookieJar
- Defined in:
- lib/wpxf/net/cookie_jar.rb
Overview
A Hash derivitive that provides cookie parsing functionality.
Instance Method Summary collapse
-
#parse(cookies) ⇒ CookieJar
Parse one or more cookies into the CookieJar.
-
#parse_cookie(cookie) ⇒ CookieJar
Parse a cookie into the CookieJar.
-
#to_s ⇒ String
A cookie string.
Instance Method Details
#parse(cookies) ⇒ CookieJar
Parse one or more cookies into the Wpxf::Net::CookieJar.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/wpxf/net/cookie_jar.rb', line 24 def parse() return self if .nil? if .is_a? String () else .each { |s| (s) } end self end |
#parse_cookie(cookie) ⇒ CookieJar
Parse a cookie into the Wpxf::Net::CookieJar.
15 16 17 18 19 |
# File 'lib/wpxf/net/cookie_jar.rb', line 15 def () key, value = .split('; ').first.split('=', 2) self[key] = value self end |
#to_s ⇒ String
Returns a cookie string.
8 9 10 |
# File 'lib/wpxf/net/cookie_jar.rb', line 8 def to_s map { |key, value| "#{key}=#{value};" }.join(' ') end |