Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

CGI::Cookie.parse

parse(raw_cookie)

Parse a raw cookie string into a hash of cookie-name=>Cookie pairs.

Example
cookies = CGI::Cookie.parse("raw_cookie_string")
  # { "name1" => cookie1, "name2" => cookie2, ... }
See also .new #domain= #httponly= also in 3.4 · 3.3 · 3.2 · 3.0