Class: RuboCop::AST::NodePattern::Compiler::Debug::Trace
Relationships & Source Files | |
Inherits: | Object |
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
Class Method Summary
- .new ⇒ Trace constructor
Instance Method Summary
- #enter(node_id)
-
#matched?(node_id) ⇒ Boolean
return nil (not visited), false (not matched) or true (matched).
- #success(node_id)
Constructor Details
.new ⇒ Trace
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 14
def initialize @visit = {} end
Instance Method Details
#enter(node_id)
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 19
def enter(node_id) @visit[node_id] = false true end
#matched?(node_id) ⇒ Boolean
return nil (not visited), false (not matched) or true (matched)
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 30
def matched?(node_id) @visit[node_id] end
#success(node_id)
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 25
def success(node_id) @visit[node_id] = true end