Class | Mustache::Template |
In: |
lib/mustache/template.rb
|
Parent: | Object |
A Template represents a Mustache template. It compiles and caches a raw string template into something usable.
The idea is this: when handed a Mustache template, convert it into a Ruby string by transforming Mustache tags into interpolated Ruby.
You shouldn‘t use this class directly, instead:
>> Mustache.render(template, hash)
source | [R] |
Expects a Mustache template as a string along with a template path, which it uses to find partials.
Does the dirty work of transforming a Mustache template into an interpolation-friendly Ruby string.
Renders the `@source` Mustache template using the given `context`, which should be a simple hash keyed with symbols.
The first time a template is rendered, this method is overriden and from then on it is "compiled". Subsequent calls will skip the compilation step and run the Ruby version of the template directly.