class Souffle::Template

Template wrapper around the Tilt Template Abstraction Library.

Public Class Methods

new(template) click to toggle source

Creates a new template.

@param [ String ] template The name of the template to render.

# File lib/souffle/template.rb, line 10
def initialize(template)
  @template = Tilt.new(
    File.expand_path("#{Souffle::Template.template_path}/#{template}"))
end
template_path() click to toggle source

Helper pointing to the default templates path.

@return [ String ] The path to the Souffle templates.

# File lib/souffle/template.rb, line 27
def self.template_path
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Public Instance Methods

render(binding) click to toggle source

Renders the template with the given binding.

@param [ Object ] binding The binding object for the template.

@return [ String ] The rendered template.

# File lib/souffle/template.rb, line 20
def render(binding)
  @template.render(binding)
end