Sha256: e93a1aed256178e4b2b0b9143cbfe563d8b8065b74b1c38ab765ce8eaae69d62
Contents?: true
Size: 731 Bytes
Versions: 7
Compression:
Stored size: 731 Bytes
Contents
require 'http/cookie_jar' require 'psych' if !defined?(YAML) && RUBY_VERSION == "1.9.2" require 'yaml' # YAMLSaver saves and loads cookies in the YAML format. class HTTP::CookieJar::YAMLSaver < HTTP::CookieJar::AbstractSaver def save(io, jar) YAML.dump(@session ? jar.to_a : jar.reject(&:session?), io) end def load(io, jar) begin data = YAML.load(io) rescue ArgumentError @logger.warn "unloadable YAML cookie data discarded" if @logger return end unless data.instance_of?(Array) @logger.warn "incompatible YAML cookie data discarded" if @logger return end data.each { |cookie| jar.add(cookie) } end private def default_options {} end end
Version data entries
7 entries across 7 versions & 1 rubygems