Class: Spoom::Model::SymbolDef

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers
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:, comments:) ⇒ SymbolDef

: (Symbol symbol, owner: Namespace?, location: Location, ?comments: Array) -> void



88
89
90
91
92
93
94
95
96
# File 'lib/spoom/model/model.rb', line 88

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

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

Instance Attribute Details

#commentsObject (readonly)

The comments associated with this definition : Array



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

def comments
  @comments
end

#locationObject (readonly)

The actual code location of this definition : Location



81
82
83
# File 'lib/spoom/model/model.rb', line 81

def location
  @location
end

#ownerObject (readonly)

The enclosing namespace this definition belongs to : Namespace?



77
78
79
# File 'lib/spoom/model/model.rb', line 77

def owner
  @owner
end

#symbolObject (readonly)

The symbol this definition belongs to : Symbol



73
74
75
# File 'lib/spoom/model/model.rb', line 73

def symbol
  @symbol
end

Instance Method Details

#full_nameObject

The full name of the symbol this definition belongs to : -> String



100
101
102
# File 'lib/spoom/model/model.rb', line 100

def full_name
  @symbol.full_name
end

#nameObject

The short name of the symbol this definition belongs to : -> String



106
107
108
# File 'lib/spoom/model/model.rb', line 106

def name
  @symbol.name
end