2008/10/8 stephan.zimmer <stephan.zimmer / googlemail.com>: > Dear all, > > say I'm given a function "f" taking a block as argument: > > def f(&block) > # some code > > p "#{block.to_code}" > end > > Is there any way to access the source code of the block, i.e. for > calling "f { x+1 }" > the "to_code" function would give back "x+1"? No, not out of the box. You would have to use ParseTreee or similar. Cheers robert -- remember.guy do |as, often| as.you_can - without end