Method: Documatic::OpenDocumentText::Helper#partial
- Defined in:
- lib/documatic/open_document_text/helper.rb
#partial(filename, assigns = {}) ⇒ Object
Inserts a partial into the document at the chosen position. This helper should be invoked from within “Ruby Block” because it inserts unescaped block-level material in the current template.
The assigns hash is passed through to the partial for binding.
This method will add the provided partial to the Documatic::Partial cache if it hasn’t yet been loaded; or if it has been loaded then the existing partial will be re-used.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/documatic/open_document_text/helper.rb', line 54 def partial(filename, assigns = {}) if template.partials.has_key?(filename) p = template.partials[filename] else p = Documatic::OpenDocumentText::Partial.new(filename) template.add_partial(filename, p) end assigns.merge!(:template => template, :master => master) p.process(assigns) end |