class Blueprint::Generator::Base::TemplateRendering

Attributes

config[R]
name[R]

Public Class Methods

new(name, config) click to toggle source
# File lib/blueprint/generator/base/template_rendering.rb, line 9
def initialize(name, config)
  @name = name
  @config = config
end

Public Instance Methods

render(template_file) click to toggle source
# File lib/blueprint/generator/base/template_rendering.rb, line 14
def render(template_file)
  template = File.open(template_file).read
  ERB.new(template, 0, '%<>').result(binding)
end
save(from, to) click to toggle source
# File lib/blueprint/generator/base/template_rendering.rb, line 19
def save(from, to)
  File.open(to, 'w+') do |f|
    f.write(render(from))
  end
end