blob: f1b800cb5338839290575b399b34e427f23a4062 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
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
module TemplateHandlers
class ERB < TemplateHandler
def compile(template)
::ERB.new(template, nil, @view.erb_trim_mode).src
end
end
end
end
|