Class: Tilt::ErubisTemplate

Inherits:
ERBTemplate show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/erubis.rb

Overview

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.

Constant Summary

Constants inherited from ERBTemplate

Tilt::ERBTemplate::SUPPORTS_KVARGS

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from ERBTemplate

default_output_variable, default_output_variable=, #precompiled_template

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(locals) ⇒ Object



37
38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/erubis.rb', line 37

def precompiled(locals)
  source, offset = super
  [source, offset - 1]
end

#precompiled_postamble(locals) ⇒ Object



30
31
32
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/erubis.rb', line 30

def precompiled_postamble(locals)
  [@outvar, super].join("\n")
end

#precompiled_preamble(locals) ⇒ Object



26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/erubis.rb', line 26

def precompiled_preamble(locals)
  [super, "#{@outvar} = _buf = String.new"].join("\n")
end

#prepareObject



18
19
20
21
22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/erubis.rb', line 18

def prepare
  @outvar = options.delete(:outvar) || self.class.default_output_variable
  @options.merge!(:preamble => false, :postamble => false, :bufvar => @outvar)
  engine_class = options.delete(:engine_class)
  engine_class = ::Erubis::EscapedEruby if options.delete(:escape_html)
  @engine = (engine_class || ::Erubis::Eruby).new(data, options)
end