title: Executing user-supplied ruby code on a web server
body: <p>I would like to let my users create Ruby scripts that do computation on some data residing on the web server and then outputs results. The scripts are executed on the server. Is there any way to do this securely?</p>
  
  <p>More specifically, I would like to:</p>
  
  <ul>
  <li>restrict the resources the script can use (memory and cpu), and limit its running time</li>
  <li>restrict which core classes the script can use (e.g. String, Fixnum, Float, Math etc)</li>
  <li>let the script access and return data</li>
  <li>output any errors to the user</li>
  </ul>
  
  <p>Are there any libraries or projects that do what I'm asking for? If not in Ruby, maybe some other language?</p>