Module: MMETools::Debug
Overview
tiny methods for debugging
Instance Method Summary collapse
-
#print_debug(stck_lvls, *vars) ⇒ Object
outputs a debug message and details of each one of the
vars
if included.
Instance Method Details
#print_debug(stck_lvls, *vars) ⇒ Object
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.
18 19 20 21 22 23 24 25 |
# 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 |