Sha256: 301588181d1635e1e69dab145cc87419e34e17acdaa185e36089c50b28512882

Contents?: true

Size: 367 Bytes

Versions: 2

Compression:

Stored size: 367 Bytes

Contents

# exceptions.rb

module Ruby2D
  class Error < StandardError
    def colorize(msg, c); "\e[#{c}m#{msg}\e[0m" end
    def error(msg); colorize(msg, '4;31') end
    def bold(msg); colorize(msg, '1') end
    
    def initialize(msg)
      super(msg)
      puts error("\nRuby 2D Error:") << " #{msg}" <<
      bold("\nOccurred in:\n  #{caller.last}\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby2d-0.3.1 lib/ruby2d/exceptions.rb
ruby2d-0.3.0 lib/ruby2d/exceptions.rb