class Awskit::Gen::TemplateWriter
Attributes
binding[RW]
filename[RW]
output_path[RW]
template[RW]
Public Class Methods
new(options)
click to toggle source
# File lib/awskit/gen/template_writer.rb, line 10 def initialize(options) self.output_path = options[:output_path] self.template = options[:template] self.binding = options[:binding] self.filename = options[:filename] end
Public Instance Methods
write!()
click to toggle source
# File lib/awskit/gen/template_writer.rb, line 17 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