Module: Kernel
- Defined in:
- lib/pretty_debug.rb,
lib/pretty_debug.rb
Constant Summary collapse
- ErrorMsgProcess =
Mutex.new
Instance Method Summary collapse
- #caller_location(i) ⇒ Object
- #load_relative(f, *rest) ⇒ Object
- #log(h) ⇒ Object
- #old_raise ⇒ Object
- #raise(*args) ⇒ Object
-
#suppress_warning ⇒ Object
Suppress warning message (“already initialized constants”, etc.).
Instance Method Details
#caller_location(i) ⇒ Object
26 |
# File 'lib/pretty_debug.rb', line 26 def caller_location i; caller_locations(i + 1, 1).first end |
#load_relative(f, *rest) ⇒ Object
27 28 29 |
# File 'lib/pretty_debug.rb', line 27 def load_relative f, *rest; load(File.(f, caller_location(1).dirname), *rest) end |
#log(h) ⇒ Object
109 110 111 112 |
# File 'lib/pretty_debug.rb', line 109 def log h h["time"] ||= Time.now.full ErrorMsgProcess.synchronize{puts(h.ltsv)} end |
#old_raise ⇒ Object
113 |
# File 'lib/pretty_debug.rb', line 113 alias old_raise :raise |
#raise(*args) ⇒ Object
114 115 116 117 118 119 |
# File 'lib/pretty_debug.rb', line 114 def raise *args old_raise *args rescue => e e.backtrace_locations = caller_locations old_raise(e) end |
#suppress_warning ⇒ Object
Suppress warning message (“already initialized constants”, etc.).
103 104 105 106 107 |
# File 'lib/pretty_debug.rb', line 103 def suppress_warning original_verbose, $VERBOSE = $VERBOSE, nil yield $VERBOSE = original_verbose end |