class Tilt::Template
def precompiled(local_keys)
offset. In most cases, overriding the #precompiled_template method is
control over source generation or want to adjust the default line
Template subclasses may override this method when they need complete
offset is the integer line offset where line reporting should begin.
source is the string containing (Ruby) source code for the template and
postamble and returns a two-tuple of the form: [source, offset], where
Generates all template source by combining the preamble, template, and
def precompiled(local_keys) preamble = precompiled_preamble(local_keys) template = precompiled_template(local_keys) postamble = precompiled_postamble(local_keys) source = String.new unless skip_compiled_encoding_detection? # Ensure that our generated source code has the same encoding as the # the source code generated by the template engine. template_encoding = extract_encoding(template){|t| template = t} if template.encoding != template_encoding # template should never be frozen here. If it was frozen originally, # then extract_encoding should yield a dup. template.force_encoding(template_encoding) end end source.force_encoding(template.encoding) source << preamble << "\n" << template << "\n" << postamble [source, preamble.count("\n")+1] end