Exception: Ruby2D::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Ruby2D::Error
- Defined in:
- lib/ruby2d/exceptions.rb
Instance Method Summary collapse
- #bold(msg) ⇒ Object
- #colorize(msg, c) ⇒ Object
- #error(msg) ⇒ Object
-
#initialize(msg) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(msg) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 14 |
# File 'lib/ruby2d/exceptions.rb', line 9 def initialize(msg) super(msg) puts error("\nRuby 2D Error:") << " " << msg puts bold("Occurred in:") puts bold(" " + caller.last), "\n" end |
Instance Method Details
#bold(msg) ⇒ Object
7 |
# File 'lib/ruby2d/exceptions.rb', line 7 def bold(msg); colorize(msg, '1') end |
#colorize(msg, c) ⇒ Object
5 |
# File 'lib/ruby2d/exceptions.rb', line 5 def colorize(msg, c); "\e[#{c}m#{msg}\e[0m" end |
#error(msg) ⇒ Object
6 |
# File 'lib/ruby2d/exceptions.rb', line 6 def error(msg); colorize(msg, '4;31') end |