3lionz Wexler wrote:
> #makes new .rb script
> f = File.open('test.rb', 'w+')
> f.write("puts 'Hello world'
> sleep 5 # seconds")
> f.close
> 
> #run test.rb

If the test.rb file that you are creating is a really just a temporary 
file and you don't need it after you create and execute it, then you 
could skip the file creation entirely by using eval() instead:

  my_new_script = "puts 'Hello world'
  sleep 5 # seconds"

  eval my_new_script # runs the Ruby script stored in the my_new_script 
string!

However, eval() can be a double-edged sword, so be careful.  Read more 
about it and you'll see what I mean.

Cheers.
-- 
Posted via http://www.ruby-forum.com/.