Class: Cuprum::Collections::Errors::ExtraAttributes

Inherits:
Error
  • Object
show all
Defined in:
lib/cuprum/collections/errors/extra_attributes.rb

Overview

Error returned when assigning invalid attributes to an entity.

Constant Summary collapse

TYPE =

Short string used to identify the type of error.

'cuprum.collections.errors.extra_attributes'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity_class:, extra_attributes:, valid_attributes:) ⇒ ExtraAttributes

Returns a new instance of ExtraAttributes.

Parameters:

  • entity_class (Class)

    The class of the assigned entity.

  • extra_attributes (Array<String>)

    The names of the extra attributes that were assigned to the entity.

  • valid_attributes (Array<String>)

    The names of valid attributes for the entity.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cuprum/collections/errors/extra_attributes.rb', line 18

def initialize(entity_class:, extra_attributes:, valid_attributes:)
  @entity_class     = entity_class
  @extra_attributes = extra_attributes
  @valid_attributes = valid_attributes

  super(
    entity_class:     entity_class,
    extra_attributes: extra_attributes,
    message:          default_message,
    valid_attributes: valid_attributes
  )
end

Instance Attribute Details

#entity_classClass (readonly)

Returns the class of the assigned entity.

Returns:

  • (Class)

    the class of the assigned entity.



32
33
34
# File 'lib/cuprum/collections/errors/extra_attributes.rb', line 32

def entity_class
  @entity_class
end

#extra_attributesArray<String> (readonly)

Returns The names of the extra attributes that were assigned to the entity.

Returns:

  • (Array<String>)

    The names of the extra attributes that were assigned to the entity.



36
37
38
# File 'lib/cuprum/collections/errors/extra_attributes.rb', line 36

def extra_attributes
  @extra_attributes
end

#valid_attributesArray<String> (readonly)

Returns The names of valid attributes for the entity.

Returns:

  • (Array<String>)

    The names of valid attributes for the entity.



39
40
41
# File 'lib/cuprum/collections/errors/extra_attributes.rb', line 39

def valid_attributes
  @valid_attributes
end