Class: Documentary::Generator
- Inherits:
-
Object
- Object
- Documentary::Generator
- Includes:
- View
- Defined in:
- lib/documentary.rb
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(file_tree, config = {}) ⇒ Generator
constructor
A new instance of Generator.
Methods included from View
#code_block, #endpoint_blocks, #resource_blocks, #title_blocks, #toc
Constructor Details
#initialize(file_tree, config = {}) ⇒ Generator
Returns a new instance of Generator.
19 20 21 22 23 |
# File 'lib/documentary.rb', line 19 def initialize(file_tree, config={}) @docblocks = DocblockCollection.new @file_tree = file_tree @config = config end |
Instance Method Details
#generate ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# 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.('../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 |