Class: QueryPackwerk::RuleRewriter::AnonymizeKeywordArgumentsRule
- Inherits:
-
BaseRule
- Object
- Parser::AST::Processor
- BaseRule
- QueryPackwerk::RuleRewriter::AnonymizeKeywordArgumentsRule
- Extended by:
- T::Sig
- Defined in:
- lib/query_packwerk/rule_rewriter/anonymize_keyword_arguments_rule.rb
Constant Summary
Constants inherited from BaseRule
Instance Method Summary collapse
Methods inherited from BaseRule
Constructor Details
This class inherits a constructor from QueryPackwerk::RuleRewriter::BaseRule
Instance Method Details
#on_send(node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/query_packwerk/rule_rewriter/anonymize_keyword_arguments_rule.rb', line 10 def on_send(node) return unless node.arguments? node.arguments.select(&:hash_type?).each do |hash_node| hash_node.children.each do |pair| _keyword_node, value_node = if pair.kwsplat_type? [nil, pair.children.first] else pair.children end # Just in case we get strangely shaped nodes next unless value_node.respond_to?(:loc) @rewriter.replace(value_node.loc.expression, ANONYMIZED) end end end |