Class: Tilt::ErubiTemplate

Inherits:
Template show all
Defined in:
lib/tilt/erubi.rb

Overview

Erubi (a simplified version of Erubis) template implementation. See github.com/jeremyevans/erubi

ErubiTemplate supports the following additional options, in addition to the options supported by the Erubi engine:

:engine_class

allows you to specify a custom engine class to use instead of the default (which is ::Erubi::Engine).

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

#precompiled_template(locals) ⇒ Object



28
29
30
# File 'lib/tilt/erubi.rb', line 28

def precompiled_template(locals)
  @src
end

#prepareObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tilt/erubi.rb', line 14

def prepare
  @options.merge!(:preamble => false, :postamble => false, :ensure=>true)

  engine_class = @options[:engine_class] || Erubi::Engine

  @engine = engine_class.new(data, @options)
  @outvar = @engine.bufvar

  # Remove dup after tilt supports frozen source.
  @src = @engine.src.dup

  @engine
end