Class: QueryPackwerk::RuleRewriter::BaseRule

Inherits:
Parser::AST::Processor
  • Object
show all
Extended by:
T::Sig
Includes:
RuboCop::AST::Traversal
Defined in:
lib/query_packwerk/rule_rewriter/base_rule.rb

Overview

Abstract base class for source code transformation rules. Extends the Parser::AST::Processor to provide common functionality for traversing and modifying Ruby abstract syntax trees during source rewriting operations.

Constant Summary collapse

ANONYMIZED =
'_'

Instance Method Summary collapse

Constructor Details

#initialize(rewriter) ⇒ BaseRule

Returns a new instance of BaseRule.



18
19
20
21
22
# File 'lib/query_packwerk/rule_rewriter/base_rule.rb', line 18

def initialize(rewriter)
  @rewriter = rewriter

  super()
end

Instance Method Details

#create_range(begin_pos, end_pos) ⇒ Object



25
26
27
# File 'lib/query_packwerk/rule_rewriter/base_rule.rb', line 25

def create_range(begin_pos, end_pos)
  Parser::Source::Range.new(@rewriter.source_buffer, begin_pos, end_pos)
end