Class: Dependabot::FileUpdaters::Ruby::Bundler::GitSourceRemover

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/file_updaters/ruby/bundler/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.



13
14
15
# File 'lib/dependabot/file_updaters/ruby/bundler/git_source_remover.rb', line 13

def initialize(dependency:)
  @dependency = dependency
end

Instance Attribute Details

#dependencyObject (readonly)

Returns the value of attribute dependency.



11
12
13
# File 'lib/dependabot/file_updaters/ruby/bundler/git_source_remover.rb', line 11

def dependency
  @dependency
end

Instance Method Details

#rewrite(content) ⇒ Object



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

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