Class: PinkSpoon::DefinitionFinder::DefFinder
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- PinkSpoon::DefinitionFinder::DefFinder
- Defined in:
- lib/pink_spoon/definition_finder.rb
Overview
Finds the line of ‘def <name>` in a parsed AST.
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
-
#initialize(method_name) ⇒ DefFinder
constructor
A new instance of DefFinder.
- #visit_def_node(node) ⇒ Object
Constructor Details
#initialize(method_name) ⇒ DefFinder
Returns a new instance of DefFinder.
131 132 133 134 |
# File 'lib/pink_spoon/definition_finder.rb', line 131 def initialize(method_name) @method_name = method_name @line = nil end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
129 130 131 |
# File 'lib/pink_spoon/definition_finder.rb', line 129 def line @line end |
Instance Method Details
#visit_def_node(node) ⇒ Object
136 137 138 139 140 141 |
# File 'lib/pink_spoon/definition_finder.rb', line 136 def visit_def_node(node) if node.name.to_s == @method_name @line ||= node.location.start_line end super end |