Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7513

Show
Ignore:
Timestamp:
09/18/07 11:56:04 (1 year ago)
Author:
bitsweat
Message:

ERB::Util#html_escape creates fewer objects

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/base.rb

    r7261 r7513  
    11require 'erb' 
     2 
     3class ERB 
     4  module Util 
     5    HTML_ESCAPE = { '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => '&lt;' } 
     6 
     7    def html_escape(s) 
     8      s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] } 
     9    end 
     10  end 
     11end 
    212 
    313module ActionView #:nodoc: