Sha256: 2733027003ca37aa3b307eedc02d983cc85b46bbdb27f4d4eea72103eeecdef6

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

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.

ExecJS supports these runtimes:

* [therubyracer](https://github.com/cowboyd/therubyracer) - Google V8
  embedded within Ruby
* [therubyrhino](https://github.com/cowboyd/therubyrhino) - Mozilla
  Rhino embedded within JRuby
* [Node.js](http://nodejs.org/)
* Apple JavaScriptCore - Included with Mac OS X
* [Microsoft Windows Script Host](http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx) (JScript)

A short example:

    require "execjs"
    ExecJS.eval "'red yellow blue'.split(' ')"
    # => ["red", "yellow", "blue"]

A longer example, demonstrating how to invoke the CoffeeScript compiler:

    require "execjs"
    require "open-uri"
    source = open("http://jashkenas.github.com/coffee-script/extras/coffee-script.js").read

    context = ExecJS.compile(source)
    context.call("CoffeeScript.compile", "square = (x) -> x * x", :bare => true)
    # => "var square;\nsquare = function(x) {\n  return x * x;\n};"

# Installation

    $ gem install execjs

# License

Copyright (c) 2013 Sam Stephenson and Josh Peek.

Released under the MIT license. See `LICENSE` for details.

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/execjs-2.0.2/README.md
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/execjs-2.0.2/README.md
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/execjs-2.0.2/README.md
execjs-2.0.2 README.md
execjs-2.0.1 README.md
execjs-2.0.0 README.md