From 159573b434e0b9b2a4f6d9f3d0169e698ace0e2e Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Mon, 1 Dec 2025 15:09:35 +0000 Subject: [PATCH] [DOC] Doc for CGI.parse --- lib/cgi/core.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 = {}