Module: Kernel

Defined in:
lib/pretty_debug.rb,
lib/pretty_debug.rb

Constant Summary collapse

ErrorMsgProcess =
Mutex.new

Instance Method Summary collapse

Instance Method Details

#caller_location(i) ⇒ Object



19
# File 'lib/pretty_debug.rb', line 19

def caller_location i; caller_locations(i + 1, 1).first end

#load_relative(f, *rest) ⇒ Object



20
21
22
# File 'lib/pretty_debug.rb', line 20

def load_relative f, *rest; 
	load(File.expand_path(f, caller_location(1).dirname), *rest)
end

#log(h) ⇒ Object



106
# File 'lib/pretty_debug.rb', line 106

def log h; ErrorMsgProcess.synchronize{puts(h.ltsv)} end

#old_raiseObject



107
# File 'lib/pretty_debug.rb', line 107

alias old_raise :raise

#raise(*args) ⇒ Object



108
109
110
111
112
113
# File 'lib/pretty_debug.rb', line 108

def raise *args
	old_raise *args
rescue => e
	e.backtrace_locations = caller_locations(2)
	old_raise(e)
end

#supress_warningObject

Supress warning message (“already initialized constants”, etc.).



100
101
102
103
104
# File 'lib/pretty_debug.rb', line 100

def supress_warning
	original_verbose, $VERBOSE = $VERBOSE, nil
	yield
	$VERBOSE =  original_verbose
end