Module: ArchUnit::GraphReporting::Projection::AggregateEdges
- Defined in:
- lib/archunit/graph/projection/aggregate_edges.rb
Overview
Aggregates selected raw edges after applying one node-collapse strategy.
Class Method Summary collapse
Class Method Details
.aggregate(edges, collapse:, include_self_dependencies:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/archunit/graph/projection/aggregate_edges.rb', line 13 def aggregate(edges, collapse:, include_self_dependencies:) groups = Hash.new do |hash, key| hash[key] = { count: 0, external: false, import_kinds: [] } end edges.each do |edge| source = CollapseNode.collapse(edge.source, collapse) target = CollapseNode.collapse(edge.target, collapse) next if !include_self_dependencies && source == target accumulate(groups[[source, target]], edge) end build_edges(groups) end |