Class: Contrast::Agent::Inventory::DependencyAnalysis

Inherits:
Object
  • Object
show all
Includes:
Dependencies, Singleton
Defined in:
lib/contrast/agent/inventory/dependency_analysis.rb

Overview

Used to collect dependencies of the application for reporting

Constant Summary

Constants included from Dependencies

Contrast::Agent::Inventory::Dependencies::CONTRAST_AGENT

Instance Method Summary collapse

Methods included from Dependencies

#loaded_specs

Instance Method Details

#library_pb_listArray<Contrast::Agent::Reporting::LibraryDiscovery>

Report the dependencies of this application

Returns:



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/contrast/agent/inventory/dependency_analysis.rb', line 20

def library_pb_list
  return Contrast::Utils::ObjectShare::EMPTY_ARRAY unless ::Contrast::INVENTORY.enable
  return Contrast::Utils::ObjectShare::EMPTY_ARRAY unless ::Contrast::INVENTORY.analyze_libraries

  loaded_specs.each_with_object([]) do |(_name, spec), reported_lib_list|
    next unless spec
    next unless (digest = Contrast::Utils::Sha256Builder.instance.build_from_spec(spec))

    reported_lib_list << Contrast::Agent::Reporting::LibraryDiscovery.new(digest, spec)
  end
end