Class: Metasploit::Model::Association::Reflection

Inherits:
Base
  • Object
show all
Defined in:
app/models/metasploit/model/association/reflection.rb

Overview

Reflection of the call to ClassMethods#association.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #valid!

Constructor Details

This class inherits a constructor from Metasploit::Model::Base

Instance Attribute Details

#class_nameString

The name #klass. The name of #klass is given instead of #klass directly when initializing this reflection to prevent circular references with autoloading or ActiveSupport::Dependencies loading.

Returns:

  • (String)

    Fully-qualified name of class in this association


12
13
14
# File 'app/models/metasploit/model/association/reflection.rb', line 12

def class_name
  @class_name
end

#modelClass

The model on which this association was declared. The equivalent for ActiveRecord association reflections would be #active_record.

Returns:

  • (Class)

19
20
21
# File 'app/models/metasploit/model/association/reflection.rb', line 19

def model
  @model
end

#nameString

The name of this association.

Returns:

  • (String)

25
26
27
# File 'app/models/metasploit/model/association/reflection.rb', line 25

def name
  @name
end

Instance Method Details

#klassObject

Class with name #class_name.

Returns:

  • []

Raises:

  • (NameError)

    if #class_name cannot be constantized


43
44
45
# File 'app/models/metasploit/model/association/reflection.rb', line 43

def klass
  class_name.constantize
end