>>>>> "C" == Clemens Wyss <wys / helbling.ch> writes:

C> matz / zetabits.com (Yukihiro Matsumoto) wrote in
C> <978962552.785938.1519.nullmailer / ev.netlab.zetabits.com>: 
>> 
>> The level 3 of $SAFE is just designed for your purpose.  If hole
>> remains, it's my fault, not yours. ;-)
>> 

C> I prefer 2, in order to also give users the eval-command!

 Perhaps there are very good reasons to run it with $SAFE >= 3

 sand.rb contains your class

pigeon% cat b.rb
#!/usr/bin/ruby
require 'sand'
s = Sandbox.new
s.execute("$stdout.reopen('b.rb', 'w'); $stdout.puts 'written'")
pigeon% 

pigeon% b.rb
pigeon% 

pigeon% cat b.rb
written
pigeon% 



Guy Decoux