Class: D3TreeGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/indexbuilders/d3treegraph.rb

Overview

Generate asciidoc that represents a given pathtree as a verbatim block with indented, clickable entries.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tree:, options: {dir_index_base_name: "index"}) ⇒ D3TreeGraph

tree: PathTree

Required node data methods

title docid

options: dir_index_base_name: String - the basename of the index file residing in each directory



14
15
16
17
# File 'lib/giblish/indexbuilders/d3treegraph.rb', line 14

def initialize(tree:, options: {dir_index_base_name: "index"})
  @tree = transform_data(tree)
  @options = options
end

Instance Attribute Details

#treeObject (readonly)

Returns the value of attribute tree.



4
5
6
# File 'lib/giblish/indexbuilders/d3treegraph.rb', line 4

def tree
  @tree
end

Instance Method Details

#sourceObject



19
20
21
22
# File 'lib/giblish/indexbuilders/d3treegraph.rb', line 19

def source
  erb_template = File.read("#{__dir__}/templates/tree.html.erb")
  ERB.new(erb_template, trim_mode: "<>").result(binding)
end