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

Inherits:
Object
  • Object
show all
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.


12
13
14
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 12

def initialize(dependency:)
  @dependency = dependency
end

Instance Attribute Details

#dependencyObject (readonly)

Returns the value of attribute dependency


10
11
12
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 10

def dependency
  @dependency
end

Instance Method Details

#rewrite(content) ⇒ Object


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

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