Class: Rigor::Inference::VoidOrigin

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

Overview

VoidOrigin = Data.define(:class_name, :method_name, :kind). Declared as a ::Data subclass because that is the shape the runtime actually builds; sig-gen cannot yet read a Data.define assignment (it reports the block body's #label against the enclosing namespace and drops the members).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#class_nameString

Returns the receiver class whose method declared -> void.

Returns:

  • (String)

    the receiver class whose method declared -> void.



17
18
19
20
21
22
23
# File 'lib/rigor/inference/void_origin.rb', line 17

VoidOrigin = Data.define(:class_name, :method_name, :kind) do
  # A human-facing `Class#method` / `Class.method` label for the diagnostic message.
  def label
    separator = kind == :singleton ? "." : "#"
    "#{class_name}#{separator}#{method_name}"
  end
end

#kindSymbol

Returns :instance or :singleton.

Returns:

  • (Symbol)

    :instance or :singleton.



17
18
19
20
21
22
23
# File 'lib/rigor/inference/void_origin.rb', line 17

VoidOrigin = Data.define(:class_name, :method_name, :kind) do
  # A human-facing `Class#method` / `Class.method` label for the diagnostic message.
  def label
    separator = kind == :singleton ? "." : "#"
    "#{class_name}#{separator}#{method_name}"
  end
end

#method_nameSymbol

Returns the method whose return was recovered.

Returns:

  • (Symbol)

    the method whose return was recovered.



17
18
19
20
21
22
23
# File 'lib/rigor/inference/void_origin.rb', line 17

VoidOrigin = Data.define(:class_name, :method_name, :kind) do
  # A human-facing `Class#method` / `Class.method` label for the diagnostic message.
  def label
    separator = kind == :singleton ? "." : "#"
    "#{class_name}#{separator}#{method_name}"
  end
end

Class Method Details

.new(class_name:, method_name:, kind:) ⇒ instance .new(class_name, method_name, kind) ⇒ instance

Overloads:

  • .new(class_name:, method_name:, kind:) ⇒ instance

    Parameters:

    • class_name: (String)
    • method_name: (Symbol)
    • kind: (Symbol)

    Returns:

    • (instance)
  • .new(class_name, method_name, kind) ⇒ instance

    Parameters:

    • class_name (String)
    • method_name (Symbol)
    • kind (Symbol)

    Returns:

    • (instance)


11
12
# File 'sig/rigor/inference/void_origin.rbs', line 11

def self.new: (class_name: String, method_name: Symbol, kind: Symbol) -> instance
| (String class_name, Symbol method_name, Symbol kind) -> instance

Instance Method Details

#labelString

A human-facing Class#method / Class.method label for the diagnostic message.

Returns:

  • (String)


19
20
21
22
# File 'lib/rigor/inference/void_origin.rb', line 19

def label
  separator = kind == :singleton ? "." : "#"
  "#{class_name}#{separator}#{method_name}"
end