class RuboCop::AST::NodePattern::Compiler::Debug::Colorizer
@api private
def initialize(pattern, compiler: self.class::Compiler.new)
def initialize(pattern, compiler: self.class::Compiler.new) @pattern = pattern @compiler = compiler @node_pattern = ::RuboCop::AST::NodePattern.new(pattern, compiler: @compiler) end
def ruby_ast(ruby)
def ruby_ast(ruby) ProcessedSource.new(ruby, RUBY_VERSION.to_f, '(ruby)').ast end
def test(ruby, trace: self.class::Compiler::Trace.new)
-
(Node)
- the Ruby AST
def test(ruby, trace: self.class::Compiler::Trace.new) ruby = ruby_ast(ruby) if ruby.is_a?(String) returned = @node_pattern.as_lambda.call(ruby, trace: trace) self.class::Result.new(self, trace, returned, ruby) end