Sha256: 9e8411a261d21547e728af7948c2ef4f50df677aebd0e4abf60a3d0547661b5a

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

require 'erb'

module Blueprint
  module Generator
    class Base
      class TemplateRendering
        attr_reader :name, :config

        def initialize(name, config)
          @name = name
          @config = config
        end

        def render(template_file)
          template = File.open(template_file).read
          ERB.new(template, 0, '%<>').result(binding)
        end

        def save(from, to)
          File.open(to, 'w+') do |f|
            f.write(render(from))
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blueprint-0.2.0 lib/blueprint/generator/base/template_rendering.rb