Possible Duplicate:
How to extract the code from a Proc object?
What is the best way to turn a proc or method object into its source string? So far, I have tried two approaches. One is to achieve the source location of the proc and read that part of the source code. The other is to use the libraries sorcerer, and ripper. I am not sure what was the correct way to do it. What is the best may depend on various factors: robustness, faithfulness to the original, speed, etc. Including the approaches that I suggested, but not limited to them, please suggest a strategy, and evaluate its limitations.