Class | Merb::Template::Haml |
In: |
merb-haml/lib/merb-haml/template.rb
|
Parent: | Object |
Defines a method for calling a specific HAML template.
path<String>: | Path to the template file. |
name<~to_s>: | The name of the template method. |
locals<Array[Symbol]>: | A list of locals to assign from the args passed into the compiled template. |
mod<Class, Module>: | The class or module wherein this method should be defined. |
# File merb-haml/lib/merb-haml/template.rb, line 13 13: def self.compile_template(io, name, locals, mod) 14: path = File.expand_path(io.path) 15: config = (Merb::Plugins.config[:haml] || {}).inject({}) do |c, (k, v)| 16: c[k.to_sym] = v 17: c 18: end.merge :filename => path 19: template = ::Haml::Engine.new(io.read, config) 20: template.def_method(mod, name, *locals) 21: name 22: end