Class: PinkSpoon::CursorLocalVarFinder
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- PinkSpoon::CursorLocalVarFinder
- Defined in:
- lib/pink_spoon/server.rb
Overview
Finds the LocalVariableReadNode whose source range covers the given cursor.
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(line, col) ⇒ CursorLocalVarFinder
constructor
A new instance of CursorLocalVarFinder.
- #visit_local_variable_read_node(node) ⇒ Object
Constructor Details
#initialize(line, col) ⇒ CursorLocalVarFinder
Returns a new instance of CursorLocalVarFinder.
205 206 207 208 |
# File 'lib/pink_spoon/server.rb', line 205 def initialize(line, col) @line = line @col = col end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
203 204 205 |
# File 'lib/pink_spoon/server.rb', line 203 def result @result end |
Instance Method Details
#visit_local_variable_read_node(node) ⇒ Object
210 211 212 213 214 215 216 217 218 |
# File 'lib/pink_spoon/server.rb', line 210 def visit_local_variable_read_node(node) loc = node.location if loc.start_line == @line && loc.start_column <= @col && loc.end_column > @col @result = node end super end |