lib/anemone/page.rb in anemone-0.3.2 vs lib/anemone/page.rb in anemone-0.4.0
- old
+ new
@@ -1,7 +1,8 @@
require 'nokogiri'
require 'ostruct'
+require 'webrick/cookie'
module Anemone
class Page
# The URL of the page
@@ -88,9 +89,16 @@
# Was the page successfully fetched?
# +true+ if the page was fetched with no error, +false+ otherwise.
#
def fetched?
@fetched
+ end
+
+ #
+ # Array of cookies received with this page as WEBrick::Cookie objects.
+ #
+ def cookies
+ WEBrick::Cookie.parse_set_cookies(@headers['Set-Cookie']) rescue []
end
#
# The content-type returned by the HTTP request for this page
#