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