Class: Dependabot::Bundler::FileUpdater::GitPinReplacer::Rewriter
- Inherits:
-
Parser::TreeRewriter
- Object
- Parser::TreeRewriter
- Dependabot::Bundler::FileUpdater::GitPinReplacer::Rewriter
- Defined in:
- lib/dependabot/bundler/file_updater/git_pin_replacer.rb
Constant Summary collapse
- PIN_KEYS =
%i(ref tag).freeze
Instance Attribute Summary collapse
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#new_pin ⇒ Object
readonly
Returns the value of attribute new_pin.
Instance Method Summary collapse
-
#initialize(dependency:, new_pin:) ⇒ Rewriter
constructor
A new instance of Rewriter.
- #on_send(node) ⇒ Object
Constructor Details
#initialize(dependency:, new_pin:) ⇒ Rewriter
Returns a new instance of Rewriter.
34 35 36 37 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 34 def initialize(dependency:, new_pin:) @dependency = dependency @new_pin = new_pin end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
31 32 33 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 31 def dependency @dependency end |
#new_pin ⇒ Object (readonly)
Returns the value of attribute new_pin.
32 33 34 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 32 def new_pin @new_pin end |
Instance Method Details
#on_send(node) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 39 def on_send(node) return unless declares_targeted_gem?(node) return unless node.children.last.type == :hash kwargs_node = node.children.last kwargs_node.children.each do |hash_pair| next unless PIN_KEYS.include?(key_from_hash_pair(hash_pair)) update_value(hash_pair) end end |