CGI.new

CGI.newで得たオブジェクトはハッシュです。与えられたフィールドはcgi.params[フィールド名]で得ることができます。
以下のCGIでは、ユーザが入力した文字列をエスケープせずに出力しますので、XSS脆弱性があります。

#!ruby
require "cgi"

cgi = CGI.new

print <<"EOD"
Content-type: text/html

<html>
<title>Hello</title>
<body>
<h1>Hello</h1>
<form method="post">
name:
<br>
<input type="text" name="name" value="">
<br>
message:
<br>
<textarea name="message">
</textarea>
<br>
<input type="submit" value="send">
</form>
<hr>
<dl>
    <dt>name</dt><dd>#{cgi.params["name"]}</dd>
    <dt>message</dt><dd>#{cgi.params["message"]}</dd>
</dl>
</body>
</html>
EOD