Exception: Objectmancy::AttributeAlreadyDefinedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/objectmancy/errors.rb

Overview

Error for defining attributes with the same name

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute) ⇒ AttributeAlreadyDefinedError

Creates a new AttributeAlreadyDefinedError

Parameters:

  • attribute (#to_s)

    name of the attribute in error


9
10
11
# File 'lib/objectmancy/errors.rb', line 9

def initialize(attribute)
  @attribute = attribute
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute


4
5
6
# File 'lib/objectmancy/errors.rb', line 4

def attribute
  @attribute
end

Instance Method Details

#messageString

Message for logging

Returns:

  • (String)

    message containing the attribute name explaining the error.


17
18
19
# File 'lib/objectmancy/errors.rb', line 17

def message
  "#{attribute} has already been defined."
end