Class: HTTP::CookieJar

Inherits:
Object
  • Object
show all
Defined in:
lib/automation_helpers/extensions/http-cookie/cookie_jar.rb

Overview

Additional useful methods to extend the HTTP::CookieJar class with

Instance Method Summary collapse

Instance Method Details

The cookie that has the supplied name

Returns:



11
12
13
# File 'lib/automation_helpers/extensions/http-cookie/cookie_jar.rb', line 11

def cookie_named(name)
  cookies.detect { |cookie| cookie.name == name }
end

#include?(cookie_name) ⇒ Boolean

Whether the cookie jar contains the cookie with the supplied name

Returns:

  • (Boolean)


18
19
20
# File 'lib/automation_helpers/extensions/http-cookie/cookie_jar.rb', line 18

def include?(cookie_name)
  cookies.any? { |cookie| cookie.name == cookie_name }
end