class Haml::Engine

def render_proc(scope = Object.new, *local_names)

Returns:
  • (Proc) - The proc that will run the template

Parameters:
  • local_names (Array) -- The names of the locals that can be passed to the proc
  • scope (Binding, Proc, Object) -- The context in which the template is evaluated
def render_proc(scope = Object.new, *local_names)
  if scope.is_a?(Binding) || scope.is_a?(Proc)
    scope_object = eval("self", scope)
  else
    scope_object = scope
    scope = scope_object.instance_eval{binding}
  end
  begin
    eval("Proc.new { |*_haml_locals| _haml_locals = _haml_locals[0] || {};" +
         compiler.precompiled_with_ambles(local_names) + "}\n", scope, @options[:filename], @options[:line])
  rescue ::SyntaxError => e
    raise SyntaxError, e.message
  end
end