mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -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:
parent
8fd263cd4e
commit
2f60bb3327
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue