Class: Ivar::TargetedPrismAnalysis
- Inherits:
-
Object
- Object
- Ivar::TargetedPrismAnalysis
- Defined in:
- lib/ivar/targeted_prism_analysis.rb
Overview
Analyzes a class to find instance variable references in specific instance methods Unlike PrismAnalysis, this targets only the class’s own methods (not inherited) and precisely locates instance variable references within each method definition
Instance Attribute Summary collapse
-
#ivars ⇒ Object
readonly
Returns the value of attribute ivars.
-
#references ⇒ Object
readonly
Returns the value of attribute references.
Instance Method Summary collapse
-
#initialize(klass) ⇒ TargetedPrismAnalysis
constructor
A new instance of TargetedPrismAnalysis.
-
#ivar_references ⇒ Object
Returns a list of hashes each representing a code reference to an ivar Each hash includes var name, path, line number, and column number.
Constructor Details
#initialize(klass) ⇒ TargetedPrismAnalysis
Returns a new instance of TargetedPrismAnalysis.
12 13 14 15 16 17 18 19 |
# File 'lib/ivar/targeted_prism_analysis.rb', line 12 def initialize(klass) @klass = klass @references = [] @method_locations = {} collect_method_locations analyze_methods @ivars = unique_ivar_names end |
Instance Attribute Details
#ivars ⇒ Object (readonly)
Returns the value of attribute ivars.
10 11 12 |
# File 'lib/ivar/targeted_prism_analysis.rb', line 10 def ivars @ivars end |
#references ⇒ Object (readonly)
Returns the value of attribute references.
10 11 12 |
# File 'lib/ivar/targeted_prism_analysis.rb', line 10 def references @references end |
Instance Method Details
#ivar_references ⇒ Object
Returns a list of hashes each representing a code reference to an ivar Each hash includes var name, path, line number, and column number
23 24 25 |
# File 'lib/ivar/targeted_prism_analysis.rb', line 23 def ivar_references @references end |