Class: QQBot::Cookie
- Inherits:
-
Object
- Object
- QQBot::Cookie
- Defined in:
- lib/qqbot/cookie.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize ⇒ Cookie
constructor
A new instance of Cookie.
- #put(set_cookie_array) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Cookie
Returns a new instance of Cookie.
4 5 6 |
# File 'lib/qqbot/cookie.rb', line 4 def initialize = {} end |
Instance Method Details
#[](key) ⇒ Object
19 20 21 |
# File 'lib/qqbot/cookie.rb', line 19 def [] key [key] || '' end |
#put(set_cookie_array) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/qqbot/cookie.rb', line 8 def put return if .nil? .each do || .split('; ').each do || k, v = .split('=') [k] = v unless v.nil? end end end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/qqbot/cookie.rb', line 23 def to_s .map{ |k, v| "#{k}=#{v}" }.join('; ') end |