Todd A. Jacobs
9/7/2007 5:22:00 AM
I found myself trying to do a bit of ruby debugging, and was going crazy
trying to figure out how to display a variable's name instead of its
value in a string. There may be a more elegant way, but I found that
symbols did what I wanted:
if $DEBUG
[:my_email, :my_resume, :my_logfile].each do |v|
$stderr.puts "DEBUG: #{v} = #{eval v.to_s}"
end
end
Is there a better way?
--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"