Class: Dependabot::Bundler::FileUpdater::RubyRequirementSetter::GemfileRewriter

Inherits:
Parser::TreeRewriter
  • Object
show all
Defined in:
lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb

Instance Method Summary collapse

Constructor Details

#initialize(ruby_version:) ⇒ GemfileRewriter

Returns a new instance of GemfileRewriter.



101
102
103
# File 'lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb', line 101

def initialize(ruby_version:)
  @ruby_version = ruby_version
end

Instance Method Details

#on_send(node) ⇒ Object



105
106
107
108
109
110
# File 'lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb', line 105

def on_send(node)
  return unless declares_ruby_version?(node)

  assigned_version_node = node.children[2]
  replace(assigned_version_node.loc.expression, "'#{ruby_version}'")
end