How can I evaluate Ruby on the server side of a NodeJS app?

I'm diving into NodeJS to build an app on Heroku to help teach my students about various aspects of a few different programming languages. Currently, the app can safely evaluate Javascript using the VM module's runInNewContext method. I'd like to add support for Ruby or Python as well.

Is it possible to safely evaluate code written in other languages, specifically Ruby or Python, on the server side of a NodeJS app?

Thanks in advance for your wisdom!

I was playing with the nodejs vm the other day, it's pretty cool... As far as I know nothing has been written yet that would do the same for Ruby. You could run ruby through the command line using the child process function in node.js though: child_process.exec(command, [options], callback). Not sure how much use that would be for you but just in case here it is:

var childProcess = require("child_process").exec;

childProcess('ruby -e "puts \'Hello World!\'"', function (err, stdout, stderr) {
    console.log(stdout);
});

I haven't tried it on heroku but it works locally, I can't see why it wouldn't work with python too. Would be very interested to hear how this works out!

You just need to run a multi-buildback on Heroku and then child_process.spawn or exec to the Ruby or Python code. Of course, you'll want to do so asynchronously, if possible.