Class: Merb::Template::Haml
- Inherits:
-
Object
- Object
- Merb::Template::Haml
- Defined in:
- lib/merb-haml/template.rb
Defined Under Namespace
Modules: Mixin
Class Method Summary collapse
-
.compile_template(io, name, mod) ⇒ Object
Defines a method for calling a specific HAML template.
Class Method Details
.compile_template(io, name, mod) ⇒ Object
Defines a method for calling a specific HAML template.
Parameters
- path
Path to the template file.
- name<~to_s>
The name of the template method.
- mod<Class, Module>
The class or module wherein this method should be defined.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/merb-haml/template.rb', line 12 def self.compile_template(io, name, mod) path = File.(io.path) config = (Merb::Plugins.config[:haml] || {}).inject({}) do |c, (k, v)| c[k.to_sym] = v c end.merge :filename => path template = ::Haml::Engine.new(io.read, config) template.def_method(mod, name) name end |