Sha256: d674e7ea55005c9e65f41ffdae34ff6ffc778ac8f1d99c93fdb248a19d8ec9a4
Contents?: true
Size: 757 Bytes
Versions: 1
Compression:
Stored size: 757 Bytes
Contents
require 'rubygems' require 'erubis' module Saga class Formatter TEMPLATE_PATH = File.expand_path('../../../templates', __FILE__) def initialize(document) @document = document end def format helpers_file = File.join(self.class.template_path, 'default/helpers.rb') load helpers_file @document.extend(Helpers) binding = @document.send(:binding) template_file = File.join(self.class.template_path, 'default/document.erb') template = Erubis::Eruby.new(File.read(template_file)) template.result(binding) end def self.format(document) formatter = new(document) formatter.format end def self.template_path TEMPLATE_PATH end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
saga-0.1.0 | lib/saga/formatter.rb |