Class: Capybara::Webkit::CookieJar
- Inherits:
-
Object
- Object
- Capybara::Webkit::CookieJar
- Defined in:
- lib/capybara/webkit/cookie_jar.rb
Overview
A simple cookie jar implementation. Does not take special cookie attributes into account like expire, max-age, httponly, secure
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
Instance Method Summary collapse
- #[](*args) ⇒ Object
- #find(name, domain = nil, path = "/") ⇒ Object
-
#initialize(browser) ⇒ CookieJar
constructor
A new instance of CookieJar.
Constructor Details
#initialize(browser) ⇒ CookieJar
Returns a new instance of CookieJar.
9 10 11 |
# File 'lib/capybara/webkit/cookie_jar.rb', line 9 def initialize(browser) @browser = browser end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
7 8 9 |
# File 'lib/capybara/webkit/cookie_jar.rb', line 7 def browser @browser end |
Instance Method Details
#[](*args) ⇒ Object
13 14 15 16 |
# File 'lib/capybara/webkit/cookie_jar.rb', line 13 def [](*args) = find(*args) && .value end |
#find(name, domain = nil, path = "/") ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/capybara/webkit/cookie_jar.rb', line 18 def find(name, domain = nil, path = "/") # we are sorting by path size because more specific paths take # precendence .sort_by { |c| -c.path.size }.find { |c| c.name.downcase == name.downcase && (!domain || valid_domain?(c, domain)) && (!path || valid_path?(c, path)) } end |