14

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?

1 Answer 1

19

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?

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.