Class: CookieJar::Cookie

Inherits:
Object
  • Object
show all
Defined in:
lib/kronk/response.rb

Instance Method Summary collapse

Instance Method Details

#to_hashObject



926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
# File 'lib/kronk/response.rb', line 926

def to_hash
  result = {
    'name'       => @name,
    'value'      => @value,
    'domain'     => @domain,
    'path'       => @path,
  }
  {
    'expiry'      => @expiry,
    'secure'      => (true if @secure),
    'http_only'   => (true if @http_only),
    'version'     => (@version if version != 0),
    'comment'     => @comment,
    'comment_url' => @comment_url,
    'discard'     => (true if @discard),
    'ports'       => @ports
  }.each do |name, value|
    result[name] = value if value
  end

  result
end