Class: Haml::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/merb-haml/template.rb

Instance Method Summary collapse

Instance Method Details

#def_method(object, name, *local_names) ⇒ Object

Parameters

object<Class, Module>

The class or module wherein this method should be defined.

name<~to_s>

The name of the template method.

*local_names

Local names to define in the HAML template.



47
48
49
50
51
52
53
54
# File 'lib/merb-haml/template.rb', line 47

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

  setup = "@_engine = 'haml'"

  object.send(method, "def #{name}(_haml_locals = {}); #{setup}; #{precompiled_with_ambles(local_names)}; end",
              @options[:filename], 0)
end