Class: Necropsy::Reachability::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/necropsy/reachability/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(graph, projection: :conservative, scope: nil) ⇒ Engine

Returns a new instance of Engine.



61
62
63
64
65
# File 'lib/necropsy/reachability/engine.rb', line 61

def initialize(graph, projection: :conservative, scope: nil)
  @graph = graph
  @projection = EvidenceStore.normalize_projection(projection)
  @scope = scope
end

Instance Method Details

#callObject



67
68
69
70
71
72
73
74
75
# File 'lib/necropsy/reachability/engine.rb', line 67

def call
  roots = graph.entry_points.group_by(&:domain)

  Result.new(
    runtime_paths: traverse(roots.fetch(:runtime, []).map(&:node_id), domain: :runtime),
    test_paths: traverse(roots.fetch(:test, []).map(&:node_id), domain: :test),
    external_paths: traverse(roots.fetch(:external, []).map(&:node_id), domain: :external)
  )
end