out

cgi.out(content_type_string='text/html')cgi.out(headers_hash) Instance Public methods Print an HTTP header and body to $DEFAULT_OUTPUT ($>) content_type_string If a string is passed, it is assumed to be the content type. headers_hash This is a Hash of headers, similar to that used by http_header. block A block is required and should evaluate to the body of the response. Content-Length is automatically calculated from the size of the String returned by the content b

http_header

http_header(content_type_string="text/html")http_header(headers_hash) Instance Public methods Create an HTTP header block as a string. Includes the empty line that ends the header block. content_type_string If this form is used, this string is the Content-Type headers_hash A Hash of header values. The following header keys are recognized: type The Content-Type header. Defaults to âtext/htmlâ charset The charset of the body, appended to the Content-Type header. nph A

header

header(options='text/html') Instance Public methods This method is an alias for http_header, when HTML5 tag maker is inactive. NOTE: use http_header to create HTTP header blocks, this alias is only provided for backwards compatibility. Using header with the HTML5 tag maker will create a <header> element. http_header

unescape_html

unescape_html(str) Class Public methods Synonym for ::unescapeHTML

unescape_element

unescape_element(str) Class Public methods Synonym for ::unescapeElement

unescapeHTML

unescapeHTML(string) Class Public methods Unescape a string that has been HTML-escaped CGI::unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;") # => "Usage: foo \"bar\" <baz>"

unescapeElement

unescapeElement(string, *elements) Class Public methods Undo escaping such as that done by ::escapeElement print CGI::unescapeElement( CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG") # "&lt;BR&gt;<A HREF="url"></A>" print CGI::unescapeElement( CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]) # "&lt;BR&gt;<A HREF="url"></A>"

unescape

unescape(string,encoding=@@accept_charset) Class Public methods URL-decode a string with encoding(optional). string = CGI::unescape("%27Stop%21%27+said+Fred") # => "'Stop!' said Fred"

rfc1123_date

rfc1123_date(time) Class Public methods Format a Time object as a String using the format specified by RFC 1123. CGI::rfc1123_date(Time.now) # Sat, 01 Jan 2000 00:00:00 GMT

pretty

pretty(string, shift = " ") Class Public methods Prettify (indent) an HTML string. string is the HTML string to indent. shift is the indentation unit to use; it defaults to two spaces. print CGI::pretty("<HTML><BODY></BODY></HTML>") # <HTML> # <BODY> # </BODY> # </HTML> print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t") # <HTML> # <BODY> # </BODY> # <