Class: Dependabot::NpmAndYarn::SubDependencyFilesFilterer

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/npm_and_yarn/sub_dependency_files_filterer.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependency_files:, updated_dependencies:) ⇒ SubDependencyFilesFilterer

Returns a new instance of SubDependencyFilesFilterer.



14
15
16
17
# File 'lib/dependabot/npm_and_yarn/sub_dependency_files_filterer.rb', line 14

def initialize(dependency_files:, updated_dependencies:)
  @dependency_files = dependency_files
  @updated_dependencies = updated_dependencies
end

Instance Method Details

#files_requiring_updateObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dependabot/npm_and_yarn/sub_dependency_files_filterer.rb', line 19

def files_requiring_update
  @files_requiring_update ||=
    lockfiles.select do |lockfile|
      lockfile_dependencies(lockfile).any? do |sub_dep|
        updated_dependencies.any? do |updated_dep|
          next false unless sub_dep.name == updated_dep.name

          version_class.new(updated_dep.version) >
            version_class.new(sub_dep.version)
        end
      end
    end
end