def def_method(object, name, *local_names)
      method = object.is_a?(Module) ? :module_eval : :instance_eval

      object.send(method, "def #{name}(_haml_locals = {}); #{@temple_engine.precompiled_with_ambles(local_names)}; end",
                  @options.filename, @options.line)
    end
def def_method(object, name, *local_names)
      method = object.is_a?(Module) ? :module_eval : :instance_eval

      object.send(method, "def #{name}(_haml_locals = {}); #{@temple_engine.precompiled_with_ambles(local_names)}; end",
                  @options.filename, @options.line)
    end
Defines a method on `object` with the given name
 that renders the template and returns the result as a string.

 If `object` is a class or module,
 the method will instead be defined as an instance method.
 For example:

     t = Time.now
     Haml::Engine.new("%p\n  Today's date is\n  .date= self.to_s").def_method(t, :render)
     t.render #=> "<p>\n  Today's date is\n  <div class='date'>Fri Nov 23 18:28:29 -0800 2007</div>\n</p>\n"

     Haml::Engine.new(".upcased= upcase").def_method(String, :upcased_div)
     "foobar".upcased_div #=> "<div class='upcased'>FOOBAR</div>\n"

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

     # This works
     obj = Object.new
     Haml::Engine.new("%p= foo").def_method(obj, :render, :foo)
     obj.render(:foo => "Hello!") #=> "<p>Hello!</p>"

     # This doesn't
     obj = Object.new
     Haml::Engine.new("%p= foo").def_method(obj, :render)
     obj.render(:foo => "Hello!") #=> NameError: undefined local variable or method `foo'

 Note that Haml modifies the evaluation context
 (either the scope object or the `self` object of the scope binding).
 It extends {Haml::Helpers}, and various instance variables are set
 (all prefixed with `haml_`).

 @param object [Object, Module] The object on which to define the method
 @param name [String, Symbol] The name of the method to define
 @param local_names [Array<Symbol>] The names of the locals that can be passed to the proc