Exception: ConfigModule::ConfigError

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

Overview

for when a config setting error occurs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ConfigError.



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

def initialize name, object, details = nil
  @name, @object, @details = name, object, details
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



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

def details
  @details
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#objectObject (readonly)

Returns the value of attribute object.



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

def object
  @object
end

Instance Method Details

#messageObject



11
12
13
# File 'lib/config_module/exceptions.rb', line 11

def message
  "invalid #{identifier} `#{name}' for #{object_info}"
end

#object_infoObject



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

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