class Tilt::Template
def compile_template_method(local_keys, scope_class=nil)
def compile_template_method(local_keys, scope_class=nil) source, offset = precompiled(local_keys) local_code = local_extraction(local_keys) method_name = "__tilt_#{Thread.current.object_id.abs}" method_source = String.new method_source.force_encoding(source.encoding) if freeze_string_literals? method_source << "# frozen-string-literal: true\n" end # Don't indent method source, to avoid indentation warnings when using compiled paths method_source << "::Tilt::TOPOBJECT.class_eval do\ndef #{method_name}(locals)\n#{local_code}\n" offset += method_source.count("\n") method_source << source method_source << "\nend;end;" bind_compiled_method(method_source, offset, scope_class) unbind_compiled_method(method_name) end