module MMETools::Debug
tiny methods for debugging
Public Instance Methods
print_debug(stck_lvls, *vars)
click to toggle source
outputs a debug message and details of each one of the vars
if included. stck_lvls
is the number of stack levels to be showed vars
is a list of vars to be pretty printed. It is convenient to make the first to be a String with an informative message.
# File lib/mme_tools/debug.rb, line 18 def print_debug(stck_lvls, *vars) @mutex ||= Mutex.new # instance mutex created the first time it is called referers = caller[0...stck_lvls] if stck_lvls > 0 @mutex.synchronize do referers.each { |r| puts "#{r}:"} vars.each { |v| pp v } if vars end end