Class: Dependabot::Bundler::FileParser::GemspecDeclarationFinder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/bundler/file_parser/gemspec_declaration_finder.rb

Overview

Checks whether a dependency is declared in a gemspec file

Instance Method Summary collapse

Constructor Details

#initialize(gemspec:) ⇒ GemspecDeclarationFinder

Returns a new instance of GemspecDeclarationFinder.



17
18
19
20
# File 'lib/dependabot/bundler/file_parser/gemspec_declaration_finder.rb', line 17

def initialize(gemspec:)
  @gemspec = gemspec
  @declaration_nodes = T.let({}, T::Hash[T::Hash[String, String], T.nilable(Parser::AST::Node)])
end

Instance Method Details

#gemspec_includes_dependency?(dependency) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/dependabot/bundler/file_parser/gemspec_declaration_finder.rb', line 23

def gemspec_includes_dependency?(dependency)
  !declaration_node(dependency).nil?
end