Module
Class Methods
lib/webrick/htmlutils.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/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
Escapes &, “, > and < in string
Instance Methods
lib/webrick/htmlutils.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/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
Escapes &, “, > and < in string