Parent

Namespace

Merb::Template::Haml

Public Class Methods

compile_template(io, name, locals, mod) click to toggle source

Defines a method for calling a specific HAML template.

Parameters

path<String>

Path to the template file.

name<~to_s>

The name of the template method.

locals>

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 lib/merb-haml/template.rb, line 13
def self.compile_template(io, name, locals, mod)
  path = File.expand_path(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, *locals)
  name
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.