print out a variable's name and value?

F

Ferenc Engard

Hello,

I want a comfortable debug function to which I can pass a variable, and
it writes out the variable's name and value. Can I accomplish this?

If I could manipulate the calling stack as bindings, and could get the
binding of the caller, then I could pass the variable's name (e.g. as
debug:)x)), and make it's name and value printed.

If I have to write debug:)x,binding()), then instead I write
debug:)x,x). :)) And I will be sad that I cannot use CPP on ruby
source. :)

Circum

PS: As you can see, it is rather a theorethical problem... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top