Class: Spoom::Model::SymbolDef

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

Overview

A SymbolDef is a definition of a Symbol

It can be a class, module, constant, method, etc. A SymbolDef has a location pointing to the actual code that defines the symbol.

Direct Known Subclasses

Constant, Namespace, Property

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, owner:, location:) ⇒ SymbolDef

Returns a new instance of SymbolDef.



74
75
76
77
78
79
80
81
# File 'lib/spoom/model/model.rb', line 74

def initialize(symbol, owner:, location:)
  @symbol = symbol
  @owner = owner
  @location = location

  symbol.definitions << self
  owner.children << self if owner
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



71
72
73
# File 'lib/spoom/model/model.rb', line 71

def location
  @location
end

#ownerObject (readonly)

Returns the value of attribute owner.



67
68
69
# File 'lib/spoom/model/model.rb', line 67

def owner
  @owner
end

#symbolObject (readonly)

Returns the value of attribute symbol.



63
64
65
# File 'lib/spoom/model/model.rb', line 63

def symbol
  @symbol
end

Instance Method Details

#full_nameObject



85
86
87
# File 'lib/spoom/model/model.rb', line 85

def full_name
  @symbol.full_name
end

#nameObject



91
92
93
# File 'lib/spoom/model/model.rb', line 91

def name
  @symbol.name
end