Class: Dependabot::Python::PipCompileFileMatcher
- Inherits:
-
Object
- Object
- Dependabot::Python::PipCompileFileMatcher
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/python/pip_compile_file_matcher.rb
Instance Method Summary collapse
-
#initialize(requirements_in_files) ⇒ PipCompileFileMatcher
constructor
A new instance of PipCompileFileMatcher.
- #lockfile_for_pip_compile_file?(file) ⇒ Boolean
Constructor Details
#initialize(requirements_in_files) ⇒ PipCompileFileMatcher
Returns a new instance of PipCompileFileMatcher.
10 11 12 |
# File 'lib/dependabot/python/pip_compile_file_matcher.rb', line 10 def initialize(requirements_in_files) @requirements_in_files = requirements_in_files end |
Instance Method Details
#lockfile_for_pip_compile_file?(file) ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dependabot/python/pip_compile_file_matcher.rb', line 15 def lockfile_for_pip_compile_file?(file) return false unless requirements_in_files.any? name = file.name return false unless name.end_with?(".txt") return true if file.content&.match?(output_file_regex(name)) basename = name.gsub(/\.txt$/, "") requirements_in_files.any? { |f| f.instance_variable_get(:@name) == basename + ".in" } end |