The gap between server-side languages and client-side languages is much narrower than its been before. With tools like Node.js, we’re now actually able to write server-side code in a language that was once exclusive to the server.
Similarly, ExecJS is a utility that allows you to run JavaScript via Ruby…
Sam Stephenson, creator of the Prototype JS framework, is also the developer behind ExecJS.
ExecJS lets you run JavaScript code from Ruby. It automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object.
The framework supports the following JavaScript runtimes:
- The Ruby Racer
- The Ruby Rhino
- Node.js
- Apple JavaScriptCore
- Mozilla SpiderMonkey
- Microsoft Windows Script Host
To get started, simply install the gem:
[cc lang=”text”]
gem install execjs
[/cc]
And you’re off.
Read more information on the project’s GitHub page.
Speak your mind...