Method: CGI.escapeHTML

Defined in:
lib/cgi/util.rb

.escapeHTML(string) ⇒ Object

Escape special characters in HTML, namely &"<>

CGI::escapeHTML('Usage: foo "bar" <baz>')
   # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"


33
34
35
# File 'lib/cgi/util.rb', line 33

def CGI::escapeHTML(string)
  string.gsub(/[&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
end