From: Ferenc Engard Date: 2003-09-13T05:18:41+09:00 Subject: Re: print out a variable's name and value? "Weirich, James" wrote: > > Ferenc Engard [mailto:ferenc@engard.hu] writes: > > I want a comfortable debug function to which I can pass a > > variable, and it writes out the variable's name and value. > > Try this: > > def dbg(&block) > varname = block.call.to_s > puts "DBG: #{varname} = #{eval(varname,block)}" > end > > x = 10 > dbg{:x} # IMPORTANT! Notice curly braces. WOW! Nice. :-)))) Circum