Sha256: ac9f6dd5047a1f8e2aca7865e716fb65d3ab2dcb74c5e5d668a0e3163ee596a8
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
module ActiveresourceResponse module HttpResponse def headers unless defined? @_active_resource_response_headers @_active_resource_response_headers = symbolize_keys(to_hash) end @_active_resource_response_headers end def cookies unless defined? @_active_resource_response_cookies @_active_resource_response_cookies = (self.headers[:set_cookie] || {}).inject({}) do |out, cookie_str| CGI::Cookie::parse(cookie_str).each do |key, cookie| out[key] = cookie.value.first unless ['expires', 'path'].include? key end out end end @_active_resource_response_cookies end private def symbolize_keys(hash) hash.inject({}) do |out, (key, value)| out[key.gsub(/-/, '_').downcase.to_sym] = value out end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activeresource-response-0.2.0 | lib/activeresource-response/http_response.rb |