class Tilt::ERBTemplate
ERB template implementation. See: www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
Public Class Methods
default_output_variable()
click to toggle source
# File lib/tilt/erb.rb 10 def self.default_output_variable 11 @@default_output_variable 12 end
default_output_variable=(name)
click to toggle source
# File lib/tilt/erb.rb 14 def self.default_output_variable=(name) 15 warn "#{self}.default_output_variable= has been replaced with the :outvar-option" 16 @@default_output_variable = name 17 end
Public Instance Methods
precompiled(locals)
click to toggle source
Calls superclass method
Template#precompiled
# File lib/tilt/erb.rb 50 def precompiled(locals) 51 source, offset = super 52 [source, offset + 1] 53 end
precompiled_postamble(locals)
click to toggle source
# File lib/tilt/erb.rb 38 def precompiled_postamble(locals) 39 <<-RUBY 40 #{super} 41 ensure 42 #{@outvar} = __original_outvar 43 end 44 RUBY 45 end
precompiled_preamble(locals)
click to toggle source
# File lib/tilt/erb.rb 30 def precompiled_preamble(locals) 31 <<-RUBY 32 begin 33 __original_outvar = #{@outvar} if defined?(#{@outvar}) 34 #{super} 35 RUBY 36 end
precompiled_template(locals)
click to toggle source
# File lib/tilt/erb.rb 25 def precompiled_template(locals) 26 source = @engine.src 27 source 28 end
prepare()
click to toggle source
# File lib/tilt/erb.rb 19 def prepare 20 @outvar = options[:outvar] || self.class.default_output_variable 21 options[:trim] = '<>' if !(options[:trim] == false) && (options[:trim].nil? || options[:trim] == true) 22 @engine = ::ERB.new(data, options[:safe], options[:trim], @outvar) 23 end