Class: Spoom::Model::Symbol

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/spoom/model/model.rb

Overview

A Symbol is a uniquely named entity in the Ruby codebase

A symbol can have multiple definitions, e.g. a class can be reopened. Sometimes a symbol can have multiple definitions of different types, e.g. ‘foo` method can be defined both as a method and as an attribute accessor.

Direct Known Subclasses

UnresolvedSymbol

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full_name) ⇒ Symbol

Returns a new instance of Symbol.



27
28
29
30
# File 'lib/spoom/model/model.rb', line 27

def initialize(full_name)
  @full_name = full_name
  @definitions = T.let([], T::Array[SymbolDef])
end

Instance Attribute Details

#definitionsObject (readonly)

Returns the value of attribute definitions.



24
25
26
# File 'lib/spoom/model/model.rb', line 24

def definitions
  @definitions
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



20
21
22
# File 'lib/spoom/model/model.rb', line 20

def full_name
  @full_name
end

Instance Method Details

#nameObject



34
35
36
# File 'lib/spoom/model/model.rb', line 34

def name
  T.must(@full_name.split("::").last)
end

#to_sObject



39
40
41
# File 'lib/spoom/model/model.rb', line 39

def to_s
  @full_name
end