Module: ColorfulExceptions
- Included in:
- Exception
- Defined in:
- lib/colorful-exceptions.rb
Instance Method Summary collapse
Instance Method Details
#backtrace ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/colorful-exceptions.rb', line 2 def backtrace value = super if value green = "\e[#{32}m" cyan = "\e[#{36}m" clear = "\e[0m" value.map do |msg| case msg when %r[\A(.*?):(\d+):in `(.*)'\z] "#{green}#{$1}#{clear}:#{green}#{$2}#{clear}: in `#{cyan}#{$3}#{clear}'" # Never seen them, but documentation insists they exist when %r[\A(.*?):(\d+)] "#{green}#{$1}#{clear}:#{green}#{$2}#{clear}" else "#{green}#{msg}#{clear}" end end else value end end |