123456789_123456789_123456789_123456789_123456789_

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

Instance Method Summary

Constructor Details

.newTrace

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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