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