Class: Hone::Patterns::EachWithIndex::LocalVariableCollector
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- Hone::Patterns::EachWithIndex::LocalVariableCollector
- Defined in:
- lib/hone/patterns/each_with_index.rb
Overview
Helper visitor to collect all local variable read references
Instance Attribute Summary collapse
-
#used_names ⇒ Object
readonly
Returns the value of attribute used_names.
Instance Method Summary collapse
-
#initialize ⇒ LocalVariableCollector
constructor
A new instance of LocalVariableCollector.
- #visit_local_variable_read_node(node) ⇒ Object
Constructor Details
#initialize ⇒ LocalVariableCollector
Returns a new instance of LocalVariableCollector.
105 106 107 |
# File 'lib/hone/patterns/each_with_index.rb', line 105 def initialize @used_names = Set.new end |
Instance Attribute Details
#used_names ⇒ Object (readonly)
Returns the value of attribute used_names.
103 104 105 |
# File 'lib/hone/patterns/each_with_index.rb', line 103 def used_names @used_names end |
Instance Method Details
#visit_local_variable_read_node(node) ⇒ Object
109 110 111 112 |
# File 'lib/hone/patterns/each_with_index.rb', line 109 def visit_local_variable_read_node(node) @used_names << node.name super end |