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