Class: Andromeda::InfoMsg
Instance Attribute Summary collapse
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg = '', details = {}) ⇒ InfoMsg
constructor
A new instance of InfoMsg.
- #to_s ⇒ Object
Constructor Details
#initialize(msg = '', details = {}) ⇒ InfoMsg
Returns a new instance of InfoMsg.
14 15 16 17 18 19 |
# File 'lib/andromeda/error.rb', line 14 def initialize(msg = '', details = {}) @msg = msg @details = details @cause = details[:cause] details.delete :cause if @cause end |
Instance Attribute Details
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
11 12 13 |
# File 'lib/andromeda/error.rb', line 11 def cause @cause end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
10 11 12 |
# File 'lib/andromeda/error.rb', line 10 def details @details end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
12 13 14 |
# File 'lib/andromeda/error.rb', line 12 def msg @msg end |
Class Method Details
Instance Method Details
#to_s ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/andromeda/error.rb', line 21 def to_s out = msg.dup if details && details.length > 0 if cause out << " (cause = #{cause}; details = \{" else out << ' (details = {' end details.each_pair { |k,v| out << " #{k}: #{v}" } out << ' })' else out << " (cause = #{cause})" if cause end out << '.' out end |