class Gem::Writter::Template

Public Class Methods

new(project) click to toggle source
# File lib/rab/gem/writer/template.rb, line 4
def initialize(project)
  @project = project
end

Protected Instance Methods

template(name) click to toggle source
# File lib/rab/gem/writer/template.rb, line 16
def template(name)
  File.expand_path File.join(File.dirname(__FILE__), "..", "templates", name)
end
write_template(template_name, to_file) click to toggle source
# File lib/rab/gem/writer/template.rb, line 10
def write_template(template_name, to_file)
  FileUtils.mkdir_p File.dirname(to_file)
  template = ERB.new File.read(template(template_name)), nil, "-"
  File.open(to_file, "w") { |f| f.write template.result(binding) }
end