Class: Ramaze::Template::Nagoro

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

Overview

Is responsible for compiling a template using the Nagoro templating engine.

Constant Summary collapse

PIPES =
::Nagoro::DEFAULT_PIPES.dup

Class Method Summary collapse

Methods inherited from Template

caching_compile, reaction_or_file, render_method, result_and_file

Methods included from Helper::Methods

extend_object, #helper, included

Class Method Details

.compile(action, template) ⇒ Object

Compile a template, applying all transformations from the pipeline and returning an instance of ::Nagoro::Template



46
47
48
# File 'lib/ramaze/template/nagoro.rb', line 46

def compile(action, template)
  ::Nagoro.compile(template)
end

.file_or_result(action) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/ramaze/template/nagoro.rb', line 33

def file_or_result(action)
  result = render_method(action).to_s

  if file = action.template
    return File.new(file)
  end

  result
end

.transform(action) ⇒ Object

Transforms an action into the XHTML code for parsing and returns the result



21
22
23
24
25
# File 'lib/ramaze/template/nagoro.rb', line 21

def transform action
  nagoro = wrap_compile(action)
  file = action.template || action.method
  nagoro.result(:file => file, :binding => action.binding)
end

.wrap_compile(action, template = nil) ⇒ Object

Use file_or_result instead of reaction_or_file



28
29
30
31
# File 'lib/ramaze/template/nagoro.rb', line 28

def wrap_compile(action, template = nil)
  template ||= file_or_result(action)
  caching_compile(action, template)
end