Class: Dependabot::Bundler::FileUpdater::GitSourceRemover::Rewriter
- Inherits:
-
Parser::TreeRewriter
- Object
- Parser::TreeRewriter
- Dependabot::Bundler::FileUpdater::GitSourceRemover::Rewriter
- Defined in:
- lib/dependabot/bundler/file_updater/git_source_remover.rb
Constant Summary collapse
- GOOD_KEYS =
TODO: Hack until Bundler 1.16.0 is available on Heroku
%i( group groups path glob name require platform platforms type source install_if ).freeze
Instance Attribute Summary collapse
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
Instance Method Summary collapse
-
#initialize(dependency:) ⇒ Rewriter
constructor
A new instance of Rewriter.
- #on_send(node) ⇒ Object
Constructor Details
#initialize(dependency:) ⇒ Rewriter
Returns a new instance of Rewriter.
38 39 40 |
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 38 def initialize(dependency:) @dependency = dependency end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
36 37 38 |
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 36 def dependency @dependency end |
Instance Method Details
#on_send(node) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dependabot/bundler/file_updater/git_source_remover.rb', line 42 def on_send(node) return unless declares_targeted_gem?(node) return unless node.children.last.type == :hash kwargs_node = node.children.last keys = kwargs_node.children.map do |hash_pair| key_from_hash_pair(hash_pair) end if keys.none? { |key| GOOD_KEYS.include?(key) } remove_all_kwargs(node) else (kwargs_node) end end |