Module: WEBrick::HTMLUtils
Relationships & Source Files | |
Defined in: | lib/webrick/htmlutils.rb |
Class Method Summary
-
.escape(string)
mod_func
Escapes &, “, > and < in
string
Class Method Details
.escape(string) (mod_func)
Escapes &, “, > and < in string
# File 'lib/webrick/htmlutils.rb', line 18
def escape(string) return "" unless string str = string.b str.gsub!(/&/n, '&') str.gsub!(/\"/n, '"') str.gsub!(/>/n, '>') str.gsub!(/</n, '<') str.force_encoding(string.encoding) end