hello, i have been looking for a solution to almost the same problem. but have not found anything yet except for a solution that uses threads. just like this code. which i have doubts about because creating threads in a web application does not seem to scale too much. konstantin "Erik Veenstra" <google / erikveen.dds.nl> wrote in message news:1139422614.523641.62400 / g14g2000cwa.googlegroups.com... > class String > def de_inspect > Thread.new do > $SAFE = 4 > > de_inspect_unsafe > end.value > end > > def de_inspect_unsafe # But fast... > eval(self, Module.new.module_eval{binding}) > end > > def evil_eval # Don't use it !!! > eval(self) > end > end > > def foo ; p [self, 1] ; end > > foo > > "def foo ; p [self, 2] ; end".evil_eval > > foo > > "def foo ; p [self, 3] ; end".de_inspect_unsafe > > foo > > "def foo ; p [self, 4] ; end".de_inspect # Will fail... > > foo >