Class: Akephalos::Client::Cookies
- Inherits:
-
Object
- Object
- Akephalos::Client::Cookies
- Includes:
- Enumerable
- Defined in:
- lib/akephalos/client/cookies.rb
Overview
Interface for working with HtmlUnit’s CookieManager, providing a basic API for manipulating the cookies in a session.
Defined Under Namespace
Classes: Cookie
Instance Method Summary collapse
- #[](name) ⇒ Cookie?
-
#clear ⇒ Object
Clears all cookies for this session.
-
#delete(cookie) ⇒ Object
Remove the cookie from the session.
-
#each ⇒ Object
Iterator for all cookies in the current session.
-
#empty? ⇒ true, false
Whether there are any cookies.
-
#initialize(cookie_manager) ⇒ Cookies
constructor
A new instance of Cookies.
Constructor Details
#initialize(cookie_manager) ⇒ Cookies
Returns a new instance of Cookies.
9 10 11 |
# File 'lib/akephalos/client/cookies.rb', line 9 def initialize() @cookie_manager = end |
Instance Method Details
#[](name) ⇒ Cookie?
16 17 18 19 |
# File 'lib/akephalos/client/cookies.rb', line 16 def [](name) = @cookie_manager.getCookie(name) Cookie.new() if end |
#clear ⇒ Object
Clears all cookies for this session.
22 23 24 |
# File 'lib/akephalos/client/cookies.rb', line 22 def clear @cookie_manager.clearCookies end |
#delete(cookie) ⇒ Object
Remove the cookie from the session.
36 37 38 |
# File 'lib/akephalos/client/cookies.rb', line 36 def delete() @cookie_manager.removeCookie(.native) end |
#each ⇒ Object
Iterator for all cookies in the current session.
27 28 29 30 31 |
# File 'lib/akephalos/client/cookies.rb', line 27 def each @cookie_manager.getCookies.each do || yield Cookie.new() end end |
#empty? ⇒ true, false
Returns whether there are any cookies.
41 42 43 |
# File 'lib/akephalos/client/cookies.rb', line 41 def empty? !any? end |