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

initialize_engine() click to toggle source
# File lib/tilt.rb, line 447
def initialize_engine
  return if defined? ::Erubis
  require_template_library 'erubis'
end
precompiled(locals) click to toggle source
# File lib/tilt.rb, line 471
def precompiled(locals)
  source, offset = super
  [source, offset - 1]
end
precompiled_postamble(locals) click to toggle source
# File lib/tilt.rb, line 464
def precompiled_postamble(locals)
  ["_buf", super].join("\n")
end
precompiled_preamble(locals) click to toggle source
# File lib/tilt.rb, line 460
def precompiled_preamble(locals)
  [super, "#{@outvar} = _buf = ''"].join("\n")
end
prepare() click to toggle source
# File lib/tilt.rb, line 452
def prepare
  @options.merge!(:preamble => false, :postamble => false)
  @outvar = options.delete(:outvar) || self.class.default_output_variable
  engine_class = options.delete(:engine_class)
  engine_class = ::Erubis::EscapedEruby if options.delete(:escape_html)
  @engine = (engine_class || ::Erubis::Eruby).new(data, options)
end