aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erb.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erb.rb')
-rw-r--r--lib/erb.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/erb.rb b/lib/erb.rb
index bb47943a86..d30911e0f1 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -10,6 +10,8 @@
#
# You can redistribute it and/or modify it under the same terms as Ruby.
+require "cgi/util"
+
#
# = ERB -- Ruby Templating
#
@@ -909,7 +911,7 @@ class ERB
# is a > 0 & a < 10?
#
def html_escape(s)
- s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
+ CGI.escapeHTML(s)
end
alias h html_escape
module_function :h