Sha256: 5f1e5b1baeefc25c6dc31d039a2089c3c24b484b96c5699e41060914a9c00c9c

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

require 'erb'

module Resulang
  class Template < SimpleDelegator
    include Rendering

    # Any 'attr_reader' attributes defined here will be
    # available in the template.
    attr_reader :template_path

    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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
resulang-3.0.0 lib/resulang/template.rb
resulang-2.0.0 lib/resulang/template.rb
resulang-1.0.0 lib/resulang/template.rb
resulang-0.0.1 lib/resulang/template.rb