Module Merb::Template
In: lib/merb-core/controller/template.rb

Methods

Classes and Modules

Class Merb::Template::Erubis

Constants

EXTENSIONS = {} unless defined?(EXTENSIONS)
METHOD_LIST = {} unless defined?(METHOD_LIST)
MTIMES = {} unless defined?(MTIMES)

Public Class methods

Finds the engine for a particular path.

Parameters

path<String>:The path of the file to find an engine for.

Returns

Class:The engine.

Takes a template at a particular path and inlines it into a module and adds it to the METHOD_LIST table to speed lookup later.

Parameters

path<String>:The full path of the template (minus the templating specifier) to inline.
mod<Module>:The module to put the compiled method into. Defaults to Merb::InlineTemplates

Notes

Even though this method supports inlining into any module, the method must be available to instances of AbstractController that will use it.

Registers the extensions that will trigger a particular templating engine.

Parameters

engine<Class>:The class of the engine that is being registered
extensions<Array[String]>:The list of extensions that will be registered with this templating language

Raises

ArgumentError:engine does not have a compile_template method.

Example

  Merb::Template.register_extensions(Merb::Template::Erubis, ["erb"])

Get the name of the template method for a particular path.

Parameters

path<String>:A full path to find a template method for.
template_stack<Array>:The template stack. Not used.

Returns

DOC

Get the template‘s method name from a full path. This replaces non-alphanumeric characters with __ and "." with "_"

Collisions are potentially possible with something like: ~foo.bar and __foo.bar or !foo.bar.

Parameters

path<String>:A full path to convert to a valid Ruby method name

Returns

String:The template name.

[Validate]