Sha256: 0bbf271be374315c6874c1aca79da0ce178963f7058f4c6aa68972f0522987c3

Contents?: true

Size: 618 Bytes

Versions: 3

Compression:

Stored size: 618 Bytes

Contents

module Awskit::Gen

  class TemplateWriter

    attr_accessor :output_path
    attr_accessor :template
    attr_accessor :binding
    attr_accessor :filename

    def initialize(options)
      self.output_path = options[:output_path]
      self.template = options[:template]
      self.binding = options[:binding]
      self.filename = options[:filename]
    end

    def write!
      t = File.open(template).read
      erb_template = ERB.new(t, nil, '-')
      content = erb_template.result(binding)
      File.open("#{output_path}/#{filename}", "w+") { |file|
        file.write(content)
      }
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awskit-0.1.2 lib/awskit/gen/template_writer.rb
awskit-0.1.1 lib/awskit/gen/template_writer.rb
awskit-0.1.0 lib/awskit/gen/template_writer.rb