Class: Resulang::Template

Inherits:
SimpleDelegator
  • Object
show all
Includes:
Rendering
Defined in:
lib/resulang/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_pathObject (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

#processObject



20
21
22
# File 'lib/resulang/template.rb', line 20

def process
  ERB.new(File.read(template_path)).result(binding)
end