13

There are several ways for running JavaScript inside of a Ruby script. For example, there is ExecJS which is frequently used for porting NPM modules to Ruby. So, is there a "ExecRuby" for Node?

user544941
  • 1,579
  • 2
  • 12
  • 16

1 Answers1

18

You can invoke Ruby like any other shell command using child_process.exec()

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

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

Don't know if that's what you're looking for?

Flambino
  • 18,507
  • 2
  • 39
  • 58
  • 3
    That's true, of course. But I'm looking for a NPM module or something similar, which handles the bridge. Just like ExecJS does in Ruby. If there aren't library for this I guess it wouldn't be too hard to port ExecJS to Node and turn it around. – user544941 Nov 12 '11 at 09:57