Could you elaborate a little more on what you are showing here?
Specifically, why is it called "de_inspect_unsafe" and what is the
array in "p [self, 1]", "p [self, 2]" etc for?

I have also wondered about this issue myself and would like to see what
people have done. I'd love to see why's "try ruby" code but that is
probably a pipe dream ...

Erik Veenstra wrote:
> 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