Sha256: 100823deeb7b5cd0ad94b02517bc4f88daff78c9a51cc147c3b346b63769b3d2

Contents?: true

Size: 532 Bytes

Versions: 6

Compression:

Stored size: 532 Bytes

Contents

require 'subtrac/config'
module Subtrac
  class Template
    def initialize(template)
      @template = template
    end
    def render
      puts "Template rendering #{@template}"
      b = Config.get_binding
      ERB.new(IO.read(@template)).result(b)
    end
    def write(outfile)
      file = File.open(outfile, 'w+')
      if file
        file_output = render()
        #puts file_output
        file.syswrite(file_output)
      else
        raise "Unable to open file for writing. file #{outfile}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ktec-subtrac-0.1.44 lib/subtrac/template.rb
ktec-subtrac-0.1.45 lib/subtrac/template.rb
ktec-subtrac-0.1.46 lib/subtrac/template.rb
ktec-subtrac-0.1.47 lib/subtrac/template.rb
ktec-subtrac-0.1.48 lib/subtrac/template.rb
ktec-subtrac-0.1.49 lib/subtrac/template.rb