Sha256: 1b5a9492413fe41c514af24110a3de7112cb14381fb787bda64b3a1be03e9110

Contents?: true

Size: 403 Bytes

Versions: 7

Compression:

Stored size: 403 Bytes

Contents

module Subtrac
  class Template
    def initialize(template)
      @template = template
    end
    def render(binding)
      ERB.new(IO.read(@template)).result(binding)
    end
    def write(outfile,binding)
      file = File.open(outfile, 'w+')
      if file
        file.syswrite(render(binding))
      else
        raise "Unable to open file for writing. file #{outfile}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ktec-subtrac-0.1.33 lib/subtrac/template.rb
ktec-subtrac-0.1.34 lib/subtrac/template.rb
ktec-subtrac-0.1.36 lib/subtrac/template.rb
ktec-subtrac-0.1.38 lib/subtrac/template.rb
ktec-subtrac-0.1.39 lib/subtrac/template.rb
ktec-subtrac-0.1.41 lib/subtrac/template.rb
ktec-subtrac-0.1.43 lib/subtrac/template.rb