Class: Resulang::Template
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Resulang::Template
- Includes:
- Rendering
- Defined in:
- lib/resulang/template.rb
Instance Attribute Summary collapse
-
#template_path ⇒ Object
readonly
Any ‘attr_reader’ attributes defined here will be available in the template.
Instance Method Summary collapse
-
#initialize(resume:, path:) ⇒ Template
constructor
A new instance of Template.
- #process ⇒ Object
Methods included from Rendering
#html_escape, #partial, #render_section
Constructor Details
#initialize(resume:, path:) ⇒ Template
Returns a new instance of Template.
11 12 13 14 15 16 17 18 |
# File 'lib/resulang/template.rb', line 11 def initialize(resume:, path:) @template_path = path # Delegate everything else to resume allows code within the template to # do things like <%= personal.name %> which is the equivalent of # <%= resume.personal.name %>. super(resume) end |
Instance Attribute Details
#template_path ⇒ Object (readonly)
Any ‘attr_reader’ attributes defined here will be available in the template.
9 10 11 |
# File 'lib/resulang/template.rb', line 9 def template_path @template_path end |
Instance Method Details
#process ⇒ Object
20 21 22 |
# File 'lib/resulang/template.rb', line 20 def process ERB.new(File.read(template_path)).result(binding) end |