Sha256: df873421464cbd52a418cac42fe8d7829378e840359a869529882a2bae382c67
Contents?: true
Size: 860 Bytes
Versions: 1
Compression:
Stored size: 860 Bytes
Contents
require "pathname" module Autodoc class Documents def initialize @table = Hash.new {|table, key| table[key] = [] } end def append(context) document = Autodoc::Document.new(context.clone) @table[document.pathname] << document end def write write_toc if Autodoc.configuration.toc write_documents end private def write_documents @table.each do |pathname, documents| pathname.parent.mkpath pathname.open("w") {|file| file << documents.map(&:render).join("\n").rstrip + "\n" } end end def write_toc toc_path.open("w") {|file| file << render_toc } end def render_toc ERB.new(Autodoc.configuration.toc_template, nil, "-").result(binding) end def toc_path Pathname.new(Autodoc.configuration.path) + "toc.md" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
autodoc-0.2.5 | lib/autodoc/documents.rb |