Class: Tilt::EtanniTemplate
Instance Attribute Summary
Attributes inherited from Template
#compiled_path, #data, #file, #line, #options
Instance Method Summary collapse
Methods inherited from Template
#basename, #compiled_method, default_mime_type, default_mime_type=, #eval_file, #fixed_locals?, #initialize, #metadata, metadata, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#precompiled(locals) ⇒ Object
30 31 32 33 |
# File 'lib/tilt/etanni.rb', line 30 def precompiled(locals) source, offset = super [source, offset + 1] end |
#precompiled_template(locals) ⇒ Object
26 27 28 |
# File 'lib/tilt/etanni.rb', line 26 def precompiled_template(locals) @code end |
#prepare ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tilt/etanni.rb', line 13 def prepare separator = data.hash.abs chomp = "<<#{separator}.chomp" start = "\n_out_ << #{chomp}\n" stop = "\n#{separator}\n" replacement = "#{stop}\\1#{start}" temp = @data.strip temp.gsub!(/<\?r\s+(.*?)\s+\?>/m, replacement) @code = "_out_ = [<<#{separator}.chomp]\n#{temp}#{stop}_out_.join" end |