Class: Rigor::Scope::ChainKey

Inherits:
Data
  • Object
show all
Defined in:
lib/rigor/scope.rb,
sig/rigor/scope.rbs

Overview

Narrowing key for a no-arg / no-block method-call chain receiver.method_name (a "single-hop" chain per A1 from the ROADMAP ยง Future cycles slice). The value of the map at this key is the narrowed type the next read of the same chain MUST observe โ€” typically the post-is_a?(C) narrowing established on a predicate edge.

  • receiver_kind โˆˆ {:local, :ivar} โ€” the analyzer only tracks chains rooted at a local or instance variable today (Law-of-Demeter-style single-hop).
  • receiver_name is the root variable's Symbol.
  • method_name is the no-arg method invoked on the root.

Chains with arguments (x.first(3)), with a block (x.detect { ... }), or with intermediate links (x.foo.bar) are NOT recorded; each loses stability for different reasons (args / block alter the call's return; multi-hop loses the LoD guarantee).

Instance Attribute Summary collapse

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name

Returns:

  • (Object)

    the current value of method_name



79
80
81
# File 'lib/rigor/scope.rb', line 79

def method_name
  @method_name
end

#receiver_kindObject (readonly)

Returns the value of attribute receiver_kind

Returns:

  • (Object)

    the current value of receiver_kind



79
80
81
# File 'lib/rigor/scope.rb', line 79

def receiver_kind
  @receiver_kind
end

#receiver_nameObject (readonly)

Returns the value of attribute receiver_name

Returns:

  • (Object)

    the current value of receiver_name



79
80
81
# File 'lib/rigor/scope.rb', line 79

def receiver_name
  @receiver_name
end