class Documentary::Generator

Attributes

config[R]
docblocks[RW]
file_tree[R]

Public Class Methods

new(file_tree, config={}) click to toggle source
# File lib/documentary.rb, line 19
def initialize(file_tree, config={})
  @docblocks = DocblockCollection.new
  @file_tree = file_tree
  @config = config
end

Public Instance Methods

generate() click to toggle source
# File lib/documentary.rb, line 25
def generate
  file_tree.each do |path|
    parsed_file = Parser.new(path)
    docblocks.concat parsed_file.docblocks
    template = File.expand_path('../default_layout.erb', __FILE__)
    erb = ERB.new(File.new(template).read, nil, '<>')
    File.open(output_file, 'w+') do |file|
      file.write erb.result(binding)
    end
  end
end

Private Instance Methods

output_file() click to toggle source
# File lib/documentary.rb, line 46
def output_file
  config[:op]
end
project_name() click to toggle source
# File lib/documentary.rb, line 42
def project_name
  config[:project]
end