diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 6a74486..92d0d6f 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -384,11 +384,14 @@ def print(*options) stdoutput.print(*options) end - # Parse an HTTP query string into a hash of key=>value pairs. + # :call-seq: + # CGI.parse(query_string) -> hash + # + # Returns a new hash built from name/value pairs in the given +query_string+: # - # params = CGI.parse("query_string") - # # {"name1" => ["value1", "value2", ...], - # # "name2" => ["value1", "value2", ...], ... } + # query = 'foo=0&bar=1&foo=2&bar=3' + # CGI.parse(query) + # # => {"foo" => ["0", "2"], "bar" => ["1", "3"]} # def self.parse(query) params = {}