Class: Capybara::Apparition::CookieJar
- Inherits:
-
Object
- Object
- Capybara::Apparition::CookieJar
- Defined in:
- lib/capybara/apparition/cookie_jar.rb
Instance Method Summary collapse
-
#find(name, domain = URI.parse(@browser.current_url).host, path = URI.parse(@browser.current_url).path) ⇒ Object
(also: #[])
def find(name, domain = nil, path = ‘/’).
-
#initialize(browser) ⇒ CookieJar
constructor
A new instance of CookieJar.
Constructor Details
#initialize(browser) ⇒ CookieJar
Returns a new instance of CookieJar.
7 8 9 |
# File 'lib/capybara/apparition/cookie_jar.rb', line 7 def initialize(browser) @browser = browser end |
Instance Method Details
#find(name, domain = URI.parse(@browser.current_url).host, path = URI.parse(@browser.current_url).path) ⇒ Object Also known as: []
def find(name, domain = nil, path = ‘/’)
12 13 14 15 16 17 18 19 |
# File 'lib/capybara/apparition/cookie_jar.rb', line 12 def find(name, domain = URI.parse(@browser.current_url).host, path = URI.parse(@browser.current_url).path) # sort by path length because more specific take precendence .sort_by { |c| -c.path.length }.find do || .name.casecmp(name).zero? && (domain.nil? || match_domain?(, domain)) && (path.nil? || match_path?(, path)) end end |