Class: KatakataIrb::TypeAnalyzer::DigTarget
- Inherits:
-
Object
- Object
- KatakataIrb::TypeAnalyzer::DigTarget
- Defined in:
- lib/katakata_irb/type_analyzer.rb
Instance Method Summary collapse
- #dig?(node) ⇒ Boolean
-
#initialize(parents, receiver, &block) ⇒ DigTarget
constructor
A new instance of DigTarget.
- #resolve(type, scope) ⇒ Object
- #target?(node) ⇒ Boolean
Constructor Details
#initialize(parents, receiver, &block) ⇒ DigTarget
Returns a new instance of DigTarget.
10 11 12 13 14 |
# File 'lib/katakata_irb/type_analyzer.rb', line 10 def initialize(parents, receiver, &block) @dig_ids = parents.to_h { [_1.__id__, true] } @target_id = receiver.__id__ @block = block end |
Instance Method Details
#dig?(node) ⇒ Boolean
16 |
# File 'lib/katakata_irb/type_analyzer.rb', line 16 def dig?(node) = @dig_ids[node.__id__] |
#resolve(type, scope) ⇒ Object
18 19 20 |
# File 'lib/katakata_irb/type_analyzer.rb', line 18 def resolve(type, scope) @block.call type, scope end |
#target?(node) ⇒ Boolean
17 |
# File 'lib/katakata_irb/type_analyzer.rb', line 17 def target?(node) = @target_id == node.__id__ |