Method: MustacheRender::Mustache::Context#partial
- Defined in:
- lib/mustache_render/mustache/context.rb
#partial(name, indentation = '') ⇒ Object
A {>partial} tag translates into a call to the context’s partial method, which would be this sucker right here.
If the Mustache view handling the rendering (e.g. the view representing your profile page or some other template) responds to partial, we call it and render the result.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mustache_render/mustache/context.rb', line 28 def partial(name, indentation = '') # Look for the first Mustache in the stack. mustache = mustache_in_stack # Indent the partial template by the given indentation. part = mustache.partial(name).to_s.gsub(/^/, indentation) # Call the Mustache's `partial` method and render the result. result = mustache.render(part, self) end |