Sha256: 756d4e10d601454fd9570caeb19f0d926157875374f1bb46d3888853a73e9971
Contents?: true
Size: 542 Bytes
Versions: 1
Compression:
Stored size: 542 Bytes
Contents
class HTTPotato::CookieHash < Hash #:nodoc: CLIENT_COOKIES = %w{path expires domain path secure HTTPOnly} def add_cookies(value) case value when Hash merge!(value) when String value.split('; ').each do |cookie| array = cookie.split('=') self[array[0].to_sym] = array[1] end else raise "add_cookies only takes a Hash or a String" end end def to_cookie_string delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s) }.collect { |k, v| "#{k}=#{v}" }.join("; ") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
httpotato-1.0.2 | lib/httpotato/cookie_hash.rb |