parse(query) public

Parse an HTTP query string into a hash of key=>value pairs.

  params = CGI::parse("query_string")
    # {"name1" => ["value1", "value2", ...],
    #  "name2" => ["value1", "value2", ...], ... }
Show source
Register or log in to add new notes.
October 17, 2012
1 thank

See also: Rack::Utils.parse_nested_query.

Note that CGI::parse does not attempt to create a multi-level object; that is, it basically ignores hard brackets in key names.

For a method that does deal with these, see Rack::Utils.parse_nested_query.