Class: Giblish::SubtreeIndexBase
- Inherits:
-
SubtreeSrcItf
- Object
- SubtreeSrcItf
- Giblish::SubtreeIndexBase
- Defined in:
- lib/giblish/indexbuilders/subtree_indices.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_INDEX_ERB =
"/standard_index.erb"
Instance Attribute Summary collapse
-
#src_location ⇒ Object
readonly
Returns the value of attribute src_location.
Instance Method Summary collapse
- #adoc_source ⇒ Object
- #document_details ⇒ Object
-
#initialize(pathtree, output_basename) ⇒ SubtreeIndexBase
constructor
A new instance of SubtreeIndexBase.
- #tree_summary ⇒ Object
Constructor Details
#initialize(pathtree, output_basename) ⇒ SubtreeIndexBase
Returns a new instance of SubtreeIndexBase.
11 12 13 14 15 16 |
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 11 def initialize(pathtree, output_basename) @pathtree = pathtree @output_basename = output_basename @src_location = pathtree.pathname.dirname @title = pathtree.segment end |
Instance Attribute Details
#src_location ⇒ Object (readonly)
Returns the value of attribute src_location.
7 8 9 |
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 7 def src_location @src_location end |
Instance Method Details
#adoc_source ⇒ Object
18 19 20 21 |
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 18 def adoc_source erb_template = File.read(__dir__ + DEFAULT_INDEX_ERB) ERB.new(erb_template, trim_mode: "<>").result(binding) end |
#document_details ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 31 def document_details details_str = "" @pathtree.traverse_preorder do |_level, node| next unless node.leaf? d = node.data details_str << (d.converted ? document_detail(node) : document_detail_fail(d)) end details_str end |
#tree_summary ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/giblish/indexbuilders/subtree_indices.rb', line 23 def tree_summary VerbatimTree.new(@pathtree.sort_leaf_first!, {dir_index_base_name: @output_basename}).source # str = "++++\n" # str += D3TreeGraph.new(tree: @pathtree, options: {dir_index_base_name: @output_basename}).source # str += "\n++++" # str end |