Class: Spoom::Model::Reference

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

Overview

A reference to something that looks like a constant or a method

Constants could be classes, modules, or actual constants. Methods could be accessors, instance or class methods, aliases, etc.

Defined Under Namespace

Classes: Kind

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.constant(name, location) ⇒ Object



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

def constant(name, location)
  new(name: name, kind: Kind::Constant, location: location)
end

.method(name, location) ⇒ Object



29
30
31
# File 'lib/spoom/model/reference.rb', line 29

def method(name, location)
  new(name: name, kind: Kind::Method, location: location)
end

Instance Method Details

#constant?Boolean

Returns:

  • (Boolean)


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

def constant?
  kind == Kind::Constant
end

#method?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/spoom/model/reference.rb', line 44

def method?
  kind == Kind::Method
end