Class: Dependabot::Bundler::FileUpdater::GitPinReplacer::Rewriter
- Inherits:
-
Parser::TreeRewriter
- Object
- Parser::TreeRewriter
- Dependabot::Bundler::FileUpdater::GitPinReplacer::Rewriter
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/bundler/file_updater/git_pin_replacer.rb
Constant Summary collapse
- PIN_KEYS =
T.let(i(ref tag).freeze, T::Array[Symbol])
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.
49 50 51 52 53 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 49 def initialize(dependency:, new_pin:) super() @dependency = T.let(dependency, Dependabot::Dependency) @new_pin = T.let(new_pin, String) end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
43 44 45 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 43 def dependency @dependency end |
#new_pin ⇒ Object (readonly)
Returns the value of attribute new_pin.
46 47 48 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 46 def new_pin @new_pin end |
Instance Method Details
#on_send(node) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/dependabot/bundler/file_updater/git_pin_replacer.rb', line 56 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 |