Class: RuboCop::AST::NodePattern::Compiler::Debug::Colorizer Private
- Inherits:
-
Object
- Object
- RuboCop::AST::NodePattern::Compiler::Debug::Colorizer
- Defined in:
- lib/rubocop/ast/node_pattern/compiler/debug.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- COLOR_SCHEME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ not_visitable: :lightseagreen, nil => :yellow, false => :red, true => :green }.freeze
- Compiler =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Debug
Instance Attribute Summary collapse
- #compiler ⇒ Object readonly private
- #node_pattern ⇒ Object readonly private
- #pattern ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(pattern, compiler: self.class::Compiler.new) ⇒ Colorizer
constructor
private
A new instance of Colorizer.
-
#test(ruby, trace: self.class::Compiler::Trace.new) ⇒ Node
private
The Ruby AST.
Constructor Details
#initialize(pattern, compiler: self.class::Compiler.new) ⇒ Colorizer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Colorizer.
96 97 98 99 100 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 96 def initialize(pattern, compiler: self.class::Compiler.new) @pattern = pattern @compiler = compiler @node_pattern = ::RuboCop::AST::NodePattern.new(pattern, compiler: @compiler) end |
Instance Attribute Details
#compiler ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 94 def compiler @compiler end |
#node_pattern ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 94 def node_pattern @node_pattern end |
#pattern ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 94 def pattern @pattern end |
Instance Method Details
#test(ruby, trace: self.class::Compiler::Trace.new) ⇒ Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the Ruby AST.
103 104 105 106 107 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 103 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 |