Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ERB::Util#html_escape creates fewer objects

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7513 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 2f60bb3327453ef214b78ed99c7e7c034774bb81 1 parent 8fd263c
@jeremy jeremy authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 actionpack/lib/action_view/base.rb
View
10 actionpack/lib/action_view/base.rb
@@ -1,5 +1,15 @@
require 'erb'
+class ERB
+ module Util
+ HTML_ESCAPE = { '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => '&lt;' }
+
+ def html_escape(s)
+ s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }
+ end
+ end
+end
+
module ActionView #:nodoc:
class ActionViewError < StandardError #:nodoc:
end
Please sign in to comment.
Something went wrong with that request. Please try again.