class Haml::Engine

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

any yields in the template will fail.
The proc doesn't take a block;

#=> NameError: undefined local variable or method `foo'
Haml::Engine.new("%p= foo").render_proc.call :foo => "Hello!"
# This doesn't

#=> "

Hello!

"
Haml::Engine.new("%p= foo").render_proc(Object.new, :foo).call :foo => "Hello!"
# This works

For example:
This is done with the +local_names+ argument.
the local variables which can be assigned must be pre-declared.
However, due to an unfortunate Ruby quirk,
The first argument of the returned proc is a hash of local variable names to values.

+scope+ works the same as it does for render.

renders the template and returns the result as a string.
Returns a proc that, when called,
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
  eval("Proc.new { |*_haml_locals| _haml_locals = _haml_locals[0] || {};" +
       precompiled_with_ambles(local_names) + "}\n", scope, @options[:filename], @options[:line])
end