From: Eric Hodel Date: 2006-12-05T03:52:35+09:00 Subject: Re: Getting the source code of a block On Dec 4, 2006, at 03:20 , Peter Szinek wrote: > Hello, > > Is the following thing possible somehow? > > def foo(&bar) > do_something_with(bar) > end > > baz = foo { puts 'hello'; i +=1; fluff(ork) } > > now, baz should contain the string > > "puts 'hello'; i +=1; fluff(ork)" $ cat x.rb require 'rubygems' require 'ruby2ruby' puts proc { |hack| puts 'hello'; i +=1; fluff(ork) }.to_ruby $ ruby x.rb proc { |hack| i puts("hello") i=(i + 1) fluff(ork) } -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net I LIT YOUR GEM ON FIRE!