From: Joel VanderWerf Date: 2004-05-25T05:39:16+09:00 Subject: RCR? change Proc#inspect to show start..end lines Proc#inspect typically returns a string like: # where the "3" is the first line of the code block in file "file.rb". It would be easier to extract the entire code block without doing parsing if Proc#inspect returned a _range_ of lines: # It would also be nice to have reader methods to get this information from the proc: Proc#file Proc#line_start Proc#line_finish Opinions? Is there something simple I'm missing? I thought that eval-ing __LINE__ against the proc's binding might give the last line of the proc's definition, but actually the results are surprisingly inconsistent: $ cat t1.rb pr = proc { 1+1 puts } p eval("__LINE__", pr) $ ruby t1.rb 2 $ cat t2.rb pr = proc { x=1+1 puts } p eval("__LINE__", pr) $ ruby t2.rb 4