lib/docify/document.rb in docify-1.0.2 vs lib/docify/document.rb in docify-1.0.3

- old
+ new

@@ -1,6 +1,6 @@ -module Docify +module Docify class Document attr_reader :path attr_reader :content # Initialize a new Document object with file path @@ -16,11 +16,11 @@ raise ArgumentError, 'Invalid format!' unless FORMATS.include?(format) result = Docify::Markup.render("doc.#{format}", File.read(@path)) if embed_css params = {:title => File.basename(@path), :content => result} params[:css] = Docify::CSS if embed_css - @content = template(params) + @content = Docify::Template.new(Docify::TEMPLATE).render(params) else @content = result end @content end @@ -32,17 +32,8 @@ end if File.directory?(path) raise ArgumentError, "Output path should be a file!" end File.open(path, 'w') { |f| f.write(@content) } - end - - private - - # Render template with provided data - def template(params={}) - TEMPLATE.gsub(REGEX) do |m| - m = params[m.scan(REGEX).flatten.last.to_sym] - end end end end \ No newline at end of file