Class: Spoom::Model::Reference

Inherits:
T::Struct
  • Object
show all
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

: (String name, Spoom::Location location) -> Reference



20
21
22
# File 'lib/spoom/model/reference.rb', line 20

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

.method(name, location) ⇒ Object

: (String name, Spoom::Location location) -> Reference



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

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

Instance Method Details

#constant?Boolean

: -> bool

Returns:

  • (Boolean)


35
36
37
# File 'lib/spoom/model/reference.rb', line 35

def constant?
  kind == Kind::Constant
end

#method?Boolean

: -> bool

Returns:

  • (Boolean)


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

def method?
  kind == Kind::Method
end