Class: Ramaze::Template::Haml

Inherits:
Template show all
Defined in:
lib/ramaze/template/haml.rb

Overview

Is responsible for compiling a template using the Haml templating engine. Can be found at: haml.hamptoncatlin.com/

Class Method Summary collapse

Methods inherited from Template

caching_compile, reaction_or_file, render_method, result_and_file, wrap_compile

Methods included from Helper::Methods

extend_object, #helper, included

Class Method Details

.compile(action, template) ⇒ Object

Instantiates Haml::Engine with the template and haml_options trait from the controller.



28
29
30
31
32
33
# File 'lib/ramaze/template/haml.rb', line 28

def compile(action, template)
  opts = action.controller.trait[:haml_options] || {}
  opts.merge! :filename => action.template if action.template

  ::Haml::Engine.new(template, opts)
end

.transform(action) ⇒ Object

Transform via Haml templating engine



20
21
22
23
# File 'lib/ramaze/template/haml.rb', line 20

def transform action
  haml = wrap_compile(action)
  haml.to_html(action.instance, action.binding.locals)
end