class Temple::Templates::Tilt

Public Class Methods

register_as(*names) click to toggle source
# File lib/temple/templates/tilt.rb, line 34
def self.register_as(*names)
  ::Tilt.register(self, *names.map(&:to_s))
end

Public Instance Methods

precompiled_template(locals = {}) click to toggle source

A string containing the (Ruby) source code for the template.

@param [Hash] locals Local variables @return [String] Compiled template ruby code

# File lib/temple/templates/tilt.rb, line 30
def precompiled_template(locals = {})
  @src
end
prepare() click to toggle source

Prepare Temple template

Called immediately after template data is loaded.

@return [void]

# File lib/temple/templates/tilt.rb, line 16
def prepare
  opts = {}.update(self.class.options).update(options).update(file: eval_file)
  metadata[:mime_type] = opts.delete(:mime_type)
  if opts.include?(:outvar)
    opts[:buffer] = opts.delete(:outvar)
    opts[:save_buffer] = true
  end
  @src = self.class.compile(data, opts)
end