Class: GemWhy::TreeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_why/tree_builder.rb

Overview

Builds tree structures from dependency chains

Instance Method Summary collapse

Instance Method Details

#build_tree_structure(chains) ⇒ Hash

Builds a tree structure from dependency chains

Parameters:

  • chains (Array<Array<Hash>>)

    the dependency chains

Returns:

  • (Hash)

    hierarchical tree structure



9
10
11
12
13
14
15
16
17
# File 'lib/gem_why/tree_builder.rb', line 9

def build_tree_structure(chains)
  tree = {}

  chains.each do |chain|
    add_chain_to_tree(tree, chain)
  end

  tree
end