Class: EventMachine::HttpClient::CookieJar

Inherits:
Object
  • Object
show all
Defined in:
lib/em-http/client.rb

Instance Method Summary (collapse)

Constructor Details

- (CookieJar) initialize



304
305
306
# File 'lib/em-http/client.rb', line 304

def initialize
  @jar = ::CookieJar::Jar.new
end

Instance Method Details

- (Object) get(uri)



312
313
314
315
# File 'lib/em-http/client.rb', line 312

def get uri
  uri = URI.parse(uri) rescue nil
  uri ? @jar.get_cookies(uri) : []
end

- (Object) set(string, uri)



308
309
310
# File 'lib/em-http/client.rb', line 308

def set string, uri
  @jar.set_cookie(uri, string) rescue nil # drop invalid cookies
end