Skip to content

Instantly share code, notes, and snippets.

@4poc
Created September 14, 2013 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4poc/6565551 to your computer and use it in GitHub Desktop.
Save 4poc/6565551 to your computer and use it in GitHub Desktop.
mechanize moneypatch: extend cookie_jar to allow to import/export cookies as strings
class Mechanize::CookieJar
public
def save_str
s = StringIO.new
save(s, :cookiestxt, :session => true)
s.string
end
def load_str(str)
s = StringIO.new str
load(s, :cookiestxt, :session => true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment