Class: Ramaze::Template::Amrita2

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

Overview

Is responsible for compiling a template using the Amrita2 templating engine. Can be found at: rubyforge.org/projects/amrita2

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

Compile a template, return instance of Amrita2::Template



39
40
41
# File 'lib/ramaze/template/amrita2.rb', line 39

def compile(action, template)
  ::Amrita2::Template.new(template)
end

.transform(action) ⇒ Object

Takes an Action The result or file is rendered using Amrita2::Template.

The context data are set to @data in the controller before expansion.



31
32
33
34
35
36
# File 'lib/ramaze/template/amrita2.rb', line 31

def transform(action)
  template = wrap_compile(action)
  data = action.instance.instance_variable_get("@data") || {}
  action.instance.extend ::Amrita2::Runtime if data.kind_of? Binding
  template.render_with(data)
end