Class: RuboCop::AST::NodePattern::Compiler::Debug::Trace
- Inherits:
-
Object
- Object
- RuboCop::AST::NodePattern::Compiler::Debug::Trace
- Defined in:
- lib/rubocop/ast/node_pattern/compiler/debug.rb
Overview
Compiled node pattern requires a named parameter ‘trace`, which should be an instance of this class
Instance Method Summary collapse
- #enter(node_id) ⇒ Object
-
#initialize ⇒ Trace
constructor
A new instance of Trace.
-
#matched?(node_id) ⇒ Boolean
return nil (not visited), false (not matched) or true (matched).
- #success(node_id) ⇒ Object
Constructor Details
#initialize ⇒ Trace
Returns a new instance of Trace.
14 15 16 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 14 def initialize @visit = {} end |
Instance Method Details
#enter(node_id) ⇒ Object
18 19 20 21 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 18 def enter(node_id) @visit[node_id] = false true end |
#matched?(node_id) ⇒ Boolean
return nil (not visited), false (not matched) or true (matched)
28 29 30 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 28 def matched?(node_id) @visit[node_id] end |
#success(node_id) ⇒ Object
23 24 25 |
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 23 def success(node_id) @visit[node_id] = true end |