Class: Dependabot::Bundler::FileUpdater::GitSourceRemover

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

Defined Under Namespace

Classes: Rewriter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:) ⇒ GitSourceRemover

Returns a new instance of GitSourceRemover.



17
18
19
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 17

def initialize(dependency:)
  @dependency = dependency
end

Instance Attribute Details

#dependencyObject (readonly)

Returns the value of attribute dependency.



15
16
17
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 15

def dependency
  @dependency
end

Instance Method Details

#rewrite(content) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 21

def rewrite(content)
  buffer = Parser::Source::Buffer.new("(gemfile_content)")
  buffer.source = content
  ast = Parser::CurrentRuby.new.parse(buffer)

  Rewriter.new(dependency: dependency).rewrite(buffer, ast)
end