Module | Merb::Template |
In: |
lib/merb-core/controller/template.rb
|
EXTENSIONS | = | {} unless defined?(EXTENSIONS) |
METHOD_LIST | = | {} unless defined?(METHOD_LIST) |
SUPPORTED_LOCALS_LIST | = | Hash.new([].freeze) unless defined?(SUPPORTED_LOCALS_LIST) |
MTIMES | = | {} unless defined?(MTIMES) |
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.
io<path>: | An IO that responds to path (File or VirtualFile) |
locals<Array[Symbol]>: | A list of local names that should be assigned in the template method from the arguments hash. Defaults to []. |
mod<Module>: | The module to put the compiled method into. Defaults to Merb::InlineTemplates |
Symbol: | The name of the method that the template was compiled into. |
Even though this method supports inlining into any module, the method must be available to instances of AbstractController that will use it.
:api: private
For a given path, get an IO object that responds to path.
This is so that plugins can override this if they provide mechanisms for specifying templates that are not just simple files. The plugin is responsible for ensuring that the fake path provided will work with template_for, and thus the RenderMixin in general.
path<String>: | A full path to find a template for. This is the |
path that the RenderMixin assumes it should find the template in.
IO#path: | An IO object that responds to path (File or VirtualFile). |
:api: plugin @overridable
Decide if a template needs to be re/compiled.
path<String>: | The full path of the template to check support for. |
locals<Array[Symbol]>: | The list of locals that need to be supported |
Boolean: | Whether or not the template for the provided path needs to be recompiled |
:api: private
Registers the extensions that will trigger a particular templating engine.
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 |
ArgumentError: | engine does not have a compile_template method. |
nil
Merb::Template.register_extensions(Merb::Template::Erubis, ["erb"])
:api: plugin
Get the name of the template method for a particular path.
path<String>: | A full path to find a template method for. |
template_stack<Array>: | The template stack. Not used. |
locals<Array[Symbol]>: | The names of local variables |
<String>: | name of the method that inlines the template. |
:api: private
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.
path<String>: | A full path to convert to a valid Ruby method name |
String: | The template name. |
We might want to replace this with something that varies the character replaced based on the non-alphanumeric character to avoid edge-case collisions.
:api: private