drlelon
1
Hello:
I’ve been wondering if it’s possible to get an object to print out the
source code of a method into a string.
It seems like it should be possible, but it’s kind of a wacky idea. I
haven’t seen it mentioned anywhere.
Thanks in advance,
David
drlelon
2
On Nov 15, 2006, at 2:37 AM, David L. wrote:
I’ve been wondering if it’s possible to get an object to print out the
source code of a method into a string.
This isn’t easy in the general sense with Ruby, because you can use
code to write, or even change, code.
However, some of the tricks for the SerializableProc Ruby Q. might
give you ideas:
http://www.rubyquiz.com/quiz38.html
See Florian G.'s solution, for example.
James Edward G. II