Sha256: 457243732e6a99345308d739b50809b177cb4f7fc04e4cfc3f5b48ece7aef124
Contents?: true
Size: 725 Bytes
Versions: 28
Compression:
Stored size: 725 Bytes
Contents
# encoding: utf-8 module LocalPac # Used to generate the template class ErbGenerator private attr_reader :data public # Create erb generator # # @param [Data] data # The data class to be used within the template def initialize(data) @data = data end # Compile the template # # @param [IO] source # The source template to be used # @param [IO] destination # The output io handle def compile(source, destination) erb = ERB.new(source.read, nil, '-') begin destination.puts erb.result(data.instance_binding) rescue SyntaxError => e raise Exceptions::ErbTemplateHasSyntaxErrors, e.message end end end end
Version data entries
28 entries across 28 versions & 1 rubygems