Exception: ConfigModule::ConfigError

Inherits:
NoMethodError
  • Object
show all
Defined in:
lib/config_module/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, object, details = nil) ⇒ ConfigError



3
4
5
6
# File 'lib/config_module/exceptions.rb', line 3

def initialize name, object, details = nil
  @name, @object, @details = name, object, details
  @custom_message = "invalid #{identifier} `#{name}' for #{object_info}"
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



7
8
9
# File 'lib/config_module/exceptions.rb', line 7

def details
  @details
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/config_module/exceptions.rb', line 7

def name
  @name
end

#objectObject (readonly)

Returns the value of attribute object.



7
8
9
# File 'lib/config_module/exceptions.rb', line 7

def object
  @object
end

Instance Method Details

#custom_messageObject Also known as: message



9
10
11
# File 'lib/config_module/exceptions.rb', line 9

def custom_message
  @custom_message + "\n#{super_message}"
end

#object_infoObject



16
17
18
19
20
21
22
# File 'lib/config_module/exceptions.rb', line 16

def object_info
  if object.is_a?(Class) then
    object.name
  else
    "instance of `#{object.class} < #{object.class.superclass}'"
  end
end