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.


95
96
97
# File 'lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb', line 95

def initialize(ruby_version:)
  @ruby_version = ruby_version
end

Instance Method Details

#on_send(node) ⇒ Object


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

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