Exception: Cog::Errors::CogError
- Inherits:
-
Exception
- Object
- Exception
- Cog::Errors::CogError
- Defined in:
- lib/cog/errors.rb
Overview
Root type for all cog errors
Instance Method Summary collapse
-
#initialize(details = {}) ⇒ CogError
constructor
A new instance of CogError.
- #message ⇒ Object
Constructor Details
#initialize(details = {}) ⇒ CogError
Returns a new instance of CogError.
7 8 9 10 11 12 13 14 15 |
# File 'lib/cog/errors.rb', line 7 def initialize(details={}) @details = if details.is_a? Hash details.to_a.collect do |key, value| "#{key} => #{value.inspect}" end.sort else [details] end end |
Instance Method Details
#message ⇒ Object
17 18 19 20 21 |
# File 'lib/cog/errors.rb', line 17 def w = || self.class.name.underscore.split('/').last.gsub('_', ' ') w += " (#{@details.join ', '})" unless @details.empty? w end |