Class: HTTParty::CookieHash
- Inherits:
-
Hash
- Object
- Hash
- HTTParty::CookieHash
- Defined in:
- lib/httparty/cookie_hash.rb
Overview
:nodoc:
Constant Summary
- CLIENT_COOKIES =
%w{path expires domain path secure HTTPOnly}
Instance Method Summary (collapse)
Instance Method Details
- (Object) add_cookies(value)
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/httparty/cookie_hash.rb', line 5 def (value) case value when Hash merge!(value) when String value.split('; ').each do || array = .split('=') self[array[0].to_sym] = array[1] end else raise "add_cookies only takes a Hash or a String" end end |
- (Object) to_cookie_string
19 20 21 |
# File 'lib/httparty/cookie_hash.rb', line 19 def delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ") end |