Class: Necropsy::Analyzers::LegacyResultAdapter
- Inherits:
-
Object
- Object
- Necropsy::Analyzers::LegacyResultAdapter
- Defined in:
- lib/necropsy/analyzers/legacy_result_adapter.rb
Instance Method Summary collapse
- #adapt(result) ⇒ Object
-
#initialize(graph:, profile:) ⇒ LegacyResultAdapter
constructor
A new instance of LegacyResultAdapter.
Constructor Details
#initialize(graph:, profile:) ⇒ LegacyResultAdapter
Returns a new instance of LegacyResultAdapter.
9 10 11 12 |
# File 'lib/necropsy/analyzers/legacy_result_adapter.rb', line 9 def initialize(graph:, profile:) @graph = graph @profile = profile end |
Instance Method Details
#adapt(result) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/necropsy/analyzers/legacy_result_adapter.rb', line 14 def adapt(result) return result unless legacy_static_result?(result) edge_evidences = normalize_edge_evidences(result.edge_evidences) alive_evidences = normalize_alive_evidences(result.alive_evidences) wrapped_evidences = {}.compare_by_identity result.edge_evidences.each { |edge| wrapped_evidences[edge.evidence] = true } result.alive_evidences.each { |alive| wrapped_evidences[alive.evidence] = true } evidences = result.evidences.reject { |record| wrapped_evidences.key?(record) }.map do |record| normalize_evidence( record, relation: record.kind, source: { 'type' => 'legacy_adapter', 'producer' => profile.name.to_s }, scope: {} ) end result.with( edge_evidences: edge_evidences, alive_evidences: alive_evidences, resolutions: graph.call_sites.map { |site| resolution_for(site) }, evidences: EvidenceCollection.collect(evidences, edge_evidences, alive_evidences) ) end |