Class: PrettyDebug

Inherits:
Object show all
Defined in:
lib/pretty_debug.rb

Class Method Summary collapse

Class Method Details

.backtrace_locations(e) ⇒ Object



51
52
53
54
# File 'lib/pretty_debug.rb', line 51

def self.backtrace_locations e
  e.complement_backtrace_locations
  caller_locations(e.backtrace_locations)
end

.caller_locations(a) ⇒ Object



55
56
57
58
59
# File 'lib/pretty_debug.rb', line 55

def self.caller_locations a
  a
  .map{|l| [l.path, l.lineno, l.base_label]}
  .transpose.tap{|_, _, m| m[-1] = ""; m.rotate!(-1)}.transpose
end

.message(e) ⇒ Object



47
48
49
50
# File 'lib/pretty_debug.rb', line 47

def self.message e
  e.complement_backtrace_locations
  e.message.dup.tap{|s| s[0] = s[0].upcase unless s.empty?}.sub(/(?<=[^.])\z/, ".")
end