Module: ExceptionString

Included in:
Exception
Defined in:
lib/exception_string.rb

Constant Summary collapse

Version =
VERSION = '0.1.2'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.versionObject



5
6
7
# File 'lib/exception_string.rb', line 5

def self.version
  Version
end

Instance Method Details

#to_s_mriObject

Formats exception data in a manner that appears the same as MRI outputs for uncaught exceptions. e.g.

boomtest.rb:18:in `go': boom (RuntimeError)
	from boomtest.rb:34:in `foo'
	from boomtest.rb:36


15
16
17
18
19
# File 'lib/exception_string.rb', line 15

def to_s_mri
  ["#{backtrace[0,1]}: #{message} (#{self.class.name})",
    backtrace[1..-1]
  ].flatten.join "\n\tfrom "
end