Class: Stache::Mustache::FasterContext

Inherits:
Mustache::Context
  • Object
show all
Defined in:
lib/stache/mustache/faster_context.rb

Instance Method Summary collapse

Instance Method Details

#partial(name, indentation = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stache/mustache/faster_context.rb', line 5

def partial(name, indentation = nil)
  # Look for the first Mustache in the stack.
  mustache = mustache_in_stack

  # Do NOT indent the partial template by the given indentation.
  part = mustache.partial(name)

  # If we already have a template, to not convert it into a string
  part = part.to_s unless part.is_a?(::Mustache::Template)

  # Call the Mustache's `partial` method and render the result.
  mustache.render(part, self)
end