chiaro scuro wrote: >>> Does anyone know how to convert a block to a string representation of >>> the code it contains? >> Read the source file? > how would I know what is the source file and lines associated with a block? > > I was really hoping to get the info from the runtime, but I guess that > what you suggest could also be a pragmatic option. OK, here are some practical options. (Sorry for the previous comment. I was trying to dig this stuff up from my memory, but Quiz 34 came up instead.) #1: You can store a Proc with its code if you're willing to forgo closure of the the environment and to use syntax like this: method_name %{ proc_code } See Ruby Quiz 38: SerializableProc - http://rubyquiz.com/quiz38.html #2: You can get it from (I think) the runtime, using ZenHacks' Proc.to_ruby. See Ryan Davis' post in response to the same quiz: http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/148082 Cheers, Dave