Class: ArchUnit::GraphReporting::Projection::SnapshotFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/archunit/graph/projection/create_snapshot.rb

Overview

Builds the one immutable representation consumed by every graph renderer.

Class Method Summary collapse

Class Method Details

.create(graph, options = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/archunit/graph/projection/create_snapshot.rb', line 18

def create(graph, options = nil)
  validate_graph(graph)
  options = GraphQueryOptions.resolve(options)
  query_edges = external_query_edges(graph, options)
  selected_nodes = NodeSelection.select(query_edges, options)
  raw_edges = selected_edges(query_edges, selected_nodes, options)
  report_edges = aggregate_edges(raw_edges, options)
  report_nodes = build_nodes(selected_nodes, report_edges, options.collapse)

  build_snapshot(options, report_nodes, report_edges, raw_edges)
end