Module: Dependz::SortDepth

Included in:
Client
Defined in:
lib/dependz/sort_depth.rb

Instance Method Summary collapse

Instance Method Details

#sort_depthObject



7
8
9
10
11
12
13
# File 'lib/dependz/sort_depth.rb', line 7

def sort_depth
  depth_of_all_item = roots
                      .map { |root| calculate_depth_from_root(dag, root) }
                      .reduce { |acc, depths| acc.merge(depths) { |_key, a, b| [a, b].max } }

  format(depth_of_all_item)
end