Class: Proforma::Template
- Includes:
- Compiling::Compilable
- Defined in:
- lib/proforma/template.rb
Overview
A Template instance is a set of modeling objects with directions on how to compile it into a Prototype object. The prototype instance can then be rendered into an end-result such as a text, pdf, or spreadsheet file.
Instance Attribute Summary collapse
- #split ⇒ Object (also: #split?)
Attributes inherited from Prototype
Instance Method Summary collapse
- #compile(data, evaluator) ⇒ Object
-
#initialize(children: [], split: false, title: '') ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(children: [], split: false, title: '') ⇒ Template
Returns a new instance of Template.
20 21 22 23 24 |
# File 'lib/proforma/template.rb', line 20 def initialize(children: [], split: false, title: '') @split = split super(children: children, title: title) end |
Instance Attribute Details
#split ⇒ Object Also known as: split?
26 27 28 |
# File 'lib/proforma/template.rb', line 26 def split @split || false end |
Instance Method Details
#compile(data, evaluator) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/proforma/template.rb', line 31 def compile(data, evaluator) if split? compile_record(data, evaluator) else compile_collection(data, evaluator) end end |