class Tilt::Template
def cached_evaluate(scope, locals, &block)
template executation is guaranteed to be performed in the scope object
unbound method which will lead to better performance. In any case,
On the sequential method calls it will compile the template to an
method is called, the template source is evaluated with instance_eval.
Process the template and return the result. The first time this
def cached_evaluate(scope, locals, &block) # Redefine itself to use method compilation the next time: def self.cached_evaluate(scope, locals, &block) method = compiled_method(locals.keys) method.bind(scope).call(locals, &block) end # Use instance_eval the first time: evaluate_source(scope, locals, &block) end