Exception: Metasploit::Model::Association::Error

Inherits:
Error
  • Object
show all
Defined in:
lib/metasploit/model/association/error.rb

Overview

Error raised by ClassMethods#reflect_on_association!.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Error

Returns a new instance of Error.

Parameters:

  • attributes (Hash{Symbol => Object}) (defaults to: {})

Options Hash (attributes):

  • :model (Class)

    ActiveModel that is missing association with :name.

  • :name (Symbol)

    name of the association that is missing.

Raises:

  • (KeyError)

    if :model is not given

  • (KeyError)

    if :name is not given


29
30
31
32
33
34
# File 'lib/metasploit/model/association/error.rb', line 29

def initialize(attributes={})
  @model = attributes.fetch(:model)
  @name = attributes.fetch(:name)

  super("#{model} does not have #{name} association.")
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model


12
13
14
# File 'lib/metasploit/model/association/error.rb', line 12

def model
  @model
end

#nameObject (readonly)

Returns the value of attribute name


18
19
20
# File 'lib/metasploit/model/association/error.rb', line 18

def name
  @name
end