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, 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
22 23 24 25 |
# File 'lib/tilt/etanni.rb', line 22 def precompiled(locals) source, offset = super [source, offset + 1] end |
#precompiled_template(locals) ⇒ Object
18 19 20 |
# File 'lib/tilt/etanni.rb', line 18 def precompiled_template(locals) @code end |
#prepare ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tilt/etanni.rb', line 5 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 |