Class Liquid::Template
In: lib/liquid/template.rb
Parent: Object

Templates are central to liquid. Interpretating templates is a two step process. First you compile the source code you got. During compile time some extensive error checking is performed. your code should expect to get some SyntaxErrors.

After you have a compiled template you can then render it. You can use a compiled template over and over again and keep it cached.

Example:

  template = Liquid::Template.parse(source)
  template.render('user_name' => 'bob')

Methods

Attributes

resource_limits  [RW] 
root  [RW] 

Public Class methods

creates a new Template from an array of tokens. Use Template.parse instead

creates a new Template object from liquid source code

Pass a module with filter methods which should be available to all liquid views. Good for registering the standard library

Public Instance methods

Parse source code. Returns self for easy chaining

Render takes a hash with local variables.

if you use the same filters over and over again consider registering them globally with Template.register_filter

Following options can be passed:

 * <tt>filters</tt> : array with local filters
 * <tt>registers</tt> : hash with register variables. Those can be accessed from
   filters and tags and might be useful to integrate liquid more with its host application

[Validate]