class Tilt::ErubisTemplate

Erubis template implementation. See: www.kuwata-lab.com/erubis/

ErubisTemplate supports the following additional options, which are not passed down to the Erubis engine:

:engine_class   allows you to specify a custom engine class to use
                instead of the default (which is ::Erubis::Eruby).

:escape_html    when true, ::Erubis::EscapedEruby will be used as
                the engine class instead of the default. All content
                within <%= %> blocks will be automatically html escaped.

Public Instance Methods

freeze_string_literals?() click to toggle source
   # File lib/tilt/erubis.rb
47 def freeze_string_literals?
48   @freeze_string_literals
49 end
precompiled(locals) click to toggle source

Erubis doesn't have ERB's line-off-by-one under 1.9 problem. Override and adjust back.

Calls superclass method Tilt::ERBTemplate#precompiled
   # File lib/tilt/erubis.rb
42 def precompiled(locals)
43   source, offset = super
44   [source, offset - 1]
45 end
precompiled_postamble(locals) click to toggle source
Calls superclass method Tilt::ERBTemplate#precompiled_postamble
   # File lib/tilt/erubis.rb
36 def precompiled_postamble(locals)
37   [@outvar, super].join("\n")
38 end
precompiled_preamble(locals) click to toggle source
Calls superclass method Tilt::ERBTemplate#precompiled_preamble
   # File lib/tilt/erubis.rb
32 def precompiled_preamble(locals)
33   [super, "#{@outvar} = _buf = String.new"].join("\n")
34 end
prepare() click to toggle source
   # File lib/tilt/erubis.rb
21 def prepare
22   @freeze_string_literals = !!@options.delete(:freeze)
23   @outvar = @options.delete(:outvar) || '_erbout'
24   @options[:preamble] = false
25   @options[:postamble] = false
26   @options[:bufvar] = @outvar
27   engine_class = @options.delete(:engine_class)
28   engine_class = ::Erubis::EscapedEruby if @options.delete(:escape_html)
29   @engine = (engine_class || ::Erubis::Eruby).new(@data, @options)
30 end