Class: Giblish::GraphPageBase
- Inherits:
-
Object
- Object
- Giblish::GraphPageBase
- Defined in:
- lib/giblish/indexbuilders/depgraphbuilder.rb
Overview
Provide the source for a graphviz-based index page.
Note: The asciidoctor-diagram API seems a bit strange when it comes to storing temporary files:
-
it uses a document attribute imagesoutdir and stores the generated svg image under that regardless of svg-type.
-
it uses an option in the diagram macro “cachedir” under which a cached image is stored.
Instance Attribute Summary collapse
-
#adoc_source ⇒ Object
readonly
Returns the value of attribute adoc_source.
Instance Method Summary collapse
-
#initialize(info_2_ids, dst_node, basename, opts = {}) ⇒ GraphPageBase
constructor
A new instance of GraphPageBase.
Constructor Details
#initialize(info_2_ids, dst_node, basename, opts = {}) ⇒ GraphPageBase
Returns a new instance of GraphPageBase.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/giblish/indexbuilders/depgraphbuilder.rb', line 15 def initialize(info_2_ids, dst_node, basename, opts = {}) # use a tmp dir since asciidoctor-diagram generates cache files # that it doesn't remove afterwards Dir.mktmpdir do |dir| # build the graph source graph = DotDigraphAdoc.new( info_2_ids: info_2_ids, opts: {"svg-type" => "inline", "cachedir" => dir} ) @adoc_source = <<~DEPGRAPH_PAGE = Dependency graph :imagesoutdir: #{dir} #{graph.source} DEPGRAPH_PAGE end end |
Instance Attribute Details
#adoc_source ⇒ Object (readonly)
Returns the value of attribute adoc_source.
13 14 15 |
# File 'lib/giblish/indexbuilders/depgraphbuilder.rb', line 13 def adoc_source @adoc_source end |