mirror of
https://github.com/github/rails.git
synced 2026-01-30 16:58:15 -05:00
ERB::Util#html_escape creates fewer objects
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7513 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
require 'erb'
|
||||
|
||||
class ERB
|
||||
module Util
|
||||
HTML_ESCAPE = { '&' => '&', '"' => '"', '>' => '>', '<' => '<' }
|
||||
|
||||
def html_escape(s)
|
||||
s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ActionView #:nodoc:
|
||||
class ActionViewError < StandardError #:nodoc:
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user