class RogerStyleGuide::Templates::Mustache::MustacheTemplate

Mustach template wrapper which handles partial resolving.

Attributes

template_context[R]

Public Instance Methods

partial(name) click to toggle source
# File lib/roger_style_guide/templates/mustache/mustache_template.rb, line 18
def partial(name)
  path = @template_context.component_template_paths(name.to_s + ".mst").find do |template_path|
    result = @template_context.renderer.send(:find_partial, template_path)
    break result if result
  end

  if path
    File.read(path)
  else
    fail "No such Mustache partial found: #{name}"
  end
end
render(template, data, template_context = nil) click to toggle source
Calls superclass method
# File lib/roger_style_guide/templates/mustache/mustache_template.rb, line 9
def render(template, data, template_context = nil)
  if template_context
    @template_context = template_context
  elsif data.respond_to?(:template_context)
    @template_context = data.template_context
  end
  super(template, data)
end