Class: Dependabot::FileParsers::Ruby::Bundler::GemfileChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/file_parsers/ruby/bundler/gemfile_checker.rb

Overview

Checks whether a dependency is declared in a Gemfile

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, gemfile:) ⇒ GemfileChecker



12
13
14
15
# File 'lib/dependabot/file_parsers/ruby/bundler/gemfile_checker.rb', line 12

def initialize(dependency:, gemfile:)
  @dependency = dependency
  @gemfile = gemfile
end

Instance Method Details

#includes_dependency?Boolean



17
18
19
20
21
22
23
# File 'lib/dependabot/file_parsers/ruby/bundler/gemfile_checker.rb', line 17

def includes_dependency?
  return false unless Parser::CurrentRuby.parse(gemfile.content)

  Parser::CurrentRuby.parse(gemfile.content).children.any? do |node|
    deep_check_for_gem(node)
  end
end