From: Peter Szinek Date: 2006-12-04T21:06:33+09:00 Subject: Re: Getting the source code of a block > Where do you need that for? I am setting up a complicated object (similar to a tree) with this code: crap = define_my_object do foo do bar baz do fluff :something => :hairy ork :something => :other end end end now, I would like to call a few methods on 'crap' which will alter the state of the object and eventually call a function which spits out crap as: crap = define_my_object do foo do bar :some => :new_param_here baz do fluff :now => :here, :are => :some, :other => things ork :and => :even, :more => nil end end end I have been thinking about some kind of serialization which would be certainly possible just by knowing crap - but since everything remains the same except a few parameters, it seemed easier to me to sub! (':something => :hairy') {':now => :here, :are => :some, :other => things'} etc. - but for this I need the string of the original block of course. bw, Peter __ http://www.rubyrailways.com