Module: Datadog::CI::SourceCode::StaticDependencies
- Defined in:
- lib/datadog/ci/source_code/static_dependencies.rb
Class Method Summary collapse
-
.fetch_static_dependencies(file) ⇒ Hash{String => Boolean}
Fetch static dependencies for a given file.
-
.populate!(root_path, ignored_path = nil) ⇒ Hash{String => Hash{String => Boolean}}
Populate the static dependencies map by scanning all live ISeqs.
Class Method Details
.fetch_static_dependencies(file) ⇒ Hash{String => Boolean}
Fetch static dependencies for a given file.
62 63 64 65 66 67 |
# File 'lib/datadog/ci/source_code/static_dependencies.rb', line 62 def self.fetch_static_dependencies(file) return {} unless @dependencies_map return {} if file.nil? @dependencies_map.fetch(file, {}) end |
.populate!(root_path, ignored_path = nil) ⇒ Hash{String => Hash{String => Boolean}}
Populate the static dependencies map by scanning all live ISeqs.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/datadog/ci/source_code/static_dependencies.rb', line 46 def self.populate!(root_path, ignored_path = nil) raise ArgumentError, "root_path must be a String and not nil" if root_path.nil? || !root_path.is_a?(String) extractor = StaticDependenciesExtractor.new(root_path, ignored_path) ISeqCollector.collect.each do |iseq| extractor.extract(iseq) end @dependencies_map = extractor.dependencies_map end |