Class: CookiePersist
- Inherits:
-
Object
- Object
- CookiePersist
- Defined in:
- lib/goshrine_bot/cookies.rb
Instance Method Summary collapse
- #cookie_hash ⇒ Object
- #cookies ⇒ Object
- #request(client, head, body) ⇒ Object
- #response(resp) ⇒ Object
Instance Method Details
#cookie_hash ⇒ Object
31 32 33 34 35 |
# File 'lib/goshrine_bot/cookies.rb', line 31 def CookieHash.new.tap { |hsh| .uniq.each { |c| hsh.(c) } } end |
#cookies ⇒ Object
27 28 29 |
# File 'lib/goshrine_bot/cookies.rb', line 27 def Thread.current[:cookies] ||= [] end |
#request(client, head, body) ⇒ Object
37 38 39 40 |
# File 'lib/goshrine_bot/cookies.rb', line 37 def request(client, head, body) head['cookie'] = . [head, body] end |
#response(resp) ⇒ Object
42 43 44 45 |
# File 'lib/goshrine_bot/cookies.rb', line 42 def response(resp) << resp.response_header[EM::HttpClient::SET_COOKIE] resp end |