aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/action_view/template_handlers/erb.rb
blob: 022fc362e76288c95858b0d20399b761cc8c9326 (plain) (tree)
1
2
3
4
5
6
7
8






                                                                                   
                                                              












                                                         
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
  module TemplateHandlers
    class ERB < TemplateHandler
      def compile(template)
        ::ERB.new(template, nil, @view.erb_trim_mode).src
      end
    end
  end
end