Class: Spoom::Model::SymbolDef Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/spoom/model/model.rb

Overview

This class is abstract.

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



85
86
87
88
89
90
91
92
93
# File 'lib/spoom/model/model.rb', line 85

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



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

def comments
  @comments
end

#locationObject (readonly)

The actual code location of this definition : Location



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

def location
  @location
end

#ownerObject (readonly)

The enclosing namespace this definition belongs to : Namespace?



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

def owner
  @owner
end

#symbolObject (readonly)

The symbol this definition belongs to : Symbol



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

def symbol
  @symbol
end

Instance Method Details

#full_nameObject

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



97
98
99
# File 'lib/spoom/model/model.rb', line 97

def full_name
  @symbol.full_name
end

#nameObject

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



103
104
105
# File 'lib/spoom/model/model.rb', line 103

def name
  @symbol.name
end