Class: CGI
Constant Summary collapse
- TABLE_FOR_ESCAPE_HTML__ =
{ '&' => '&', '"' => '"', '<' => '<', '>' => '>', }
Class Method Summary collapse
-
.escapeHTML(string) ⇒ Object
Escape special characters in HTML, namely &"<> CGI::escapeHTML(‘Usage: foo “bar” <baz>’) # => “Usage: foo "bar" <baz>”.
Class Method Details
.escapeHTML(string) ⇒ Object
Escape special characters in HTML, namely &"<>
CGI::escapeHTML('Usage: foo "bar" <baz>')
# => "Usage: foo "bar" <baz>"
12 13 14 |
# File 'lib/extensions/rhocgi/cgi.rb', line 12 def CGI::escapeHTML(string) string.gsub(/[&\"<>]/, TABLE_FOR_ESCAPE_HTML__) end |