Sha256: c149c62871e7596df49833fd65f5446dabc4443d2afc872d13aacf05b4d0dbf2
Contents?: true
Size: 728 Bytes
Versions: 20
Compression:
Stored size: 728 Bytes
Contents
# encoding: utf-8 module TestServer # 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
20 entries across 20 versions & 1 rubygems