Class: Yarrow::Output::Generator
- Inherits:
-
Object
- Object
- Yarrow::Output::Generator
- Defined in:
- lib/yarrow/output/generator.rb
Overview
Generates documentation from an object model.
Instance Method Summary collapse
-
#build_docs ⇒ Object
Builds the output documentation.
-
#converter ⇒ Object
Template converter used by this generator instance.
-
#initialize(config = {}) ⇒ Generator
constructor
A new instance of Generator.
-
#object_map ⇒ Object
Mapping between template types and provided object model.
-
#template_map ⇒ Object
Mapping between template types and provided output templates.
- #write_output_file(filename, content) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Generator
Returns a new instance of Generator.
5 6 7 |
# File 'lib/yarrow/output/generator.rb', line 5 def initialize(config={}) @config = config end |
Instance Method Details
#build_docs ⇒ Object
Builds the output documentation.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/yarrow/output/generator.rb', line 28 def build_docs object_map.each do |index, objects| objects.each do |object| template_context = { #:meta => Site index => object } content = converter.render(template_map[index], template_context) filename = converter.filename_for(object) write_output_file(filename, content) end end end |
#converter ⇒ Object
Template converter used by this generator instance.
20 21 22 |
# File 'lib/yarrow/output/generator.rb', line 20 def converter end |
#object_map ⇒ Object
Mapping between template types and provided object model
10 11 12 |
# File 'lib/yarrow/output/generator.rb', line 10 def object_map @config.output.object_map end |
#template_map ⇒ Object
Mapping between template types and provided output templates.
15 16 17 |
# File 'lib/yarrow/output/generator.rb', line 15 def template_map end |
#write_output_file(filename, content) ⇒ Object
24 25 |
# File 'lib/yarrow/output/generator.rb', line 24 def write_output_file(filename, content) end |