From: Paul Brannan Date: 2002-12-07T06:03:46+09:00 Subject: Re: Is it possible to convert a proc object or block to a string of Ruby code? On Sat, Dec 07, 2002 at 04:54:08AM +0900, Rich Kilmer wrote: > Matz does not hold the source code in memory so...no you cannot (unless > you did your own loading of the proc from eval'ing a string and then > keeping a handle to it.) Matz does keep nodes for line numbers, though. So one (very ugly) possibility would be to: - Find the first node for the proc - Find the first NODE_NEWLINE; that should contain the line number the proc starts on. - Open the file that node points to and start reading. This will let you get a string from a proc, but procs contain a lot more state than just the nodes that need to be evaluated. Saving this state and reloading it would be an interesting exercise, to say the least. Paul