module WEBrick::HTMLUtils
Public Class Methods
escape(string)
click to toggle source
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
Private Instance Methods
escape(string)
click to toggle source
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