Builds a CGI form.
URL-encode a string.
URL-encode a string and write the result to an IO.
Parses an HTTP query and yields each key-value pair
URL-decode a string and write the result to an IO.
URL-decode a string.
Builds a CGI form.
The yielded object has an add method that accepts two arguments,
a key (String) and a value (String or Nil). Keys and values are escaped
using CGI#escape.
params = CGI.build_form do |form|
form.add "color", "black"
form.add "name", "crystal"
form.add "year", "2012 - today"
end
params #=> "color=black&name=crystal&year=2012%20-%20today"URL-encode a string.
CGI.escape("'Stop!' said Fred") #=> "%27Stop%21%27+said+Fred"Parses an HTTP query and yields each key-value pair
CGI.parse(query) do |key, value|
# ...
endURL-decode a string.
CGI.unescape("%27Stop%21%27+said+Fred") #=> "'Stop!' said Fred"