Class: Spoom::Model::Symbol
- Inherits:
-
Object
- Object
- Spoom::Model::Symbol
- 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
Instance Attribute Summary collapse
-
#definitions ⇒ Object
readonly
The definitions of this symbol (where it exists in the code).
-
#full_name ⇒ Object
readonly
The full, unique name of this symbol.
Instance Method Summary collapse
-
#initialize(full_name) ⇒ Symbol
constructor
A new instance of Symbol.
-
#name ⇒ Object
The short name of this symbol.
- #to_s ⇒ Object
Constructor Details
#initialize(full_name) ⇒ Symbol
Returns a new instance of Symbol.
37 38 39 40 |
# File 'lib/spoom/model/model.rb', line 37 def initialize(full_name) @full_name = full_name @definitions = [] #: Array[SymbolDef] end |
Instance Attribute Details
#definitions ⇒ Object (readonly)
The definitions of this symbol (where it exists in the code)
34 35 36 |
# File 'lib/spoom/model/model.rb', line 34 def definitions @definitions end |
#full_name ⇒ Object (readonly)
The full, unique name of this symbol
30 31 32 |
# File 'lib/spoom/model/model.rb', line 30 def full_name @full_name end |
Instance Method Details
#name ⇒ Object
The short name of this symbol
44 45 46 |
# File 'lib/spoom/model/model.rb', line 44 def name T.must(@full_name.split("::").last) end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/spoom/model/model.rb', line 49 def to_s @full_name end |