A JavaScript standard library based on the Ruby core-lib

RubyJS is a JavaScript implementation of all methods from Ruby classes like Array, String, Numbers, Time and more.

Read the announcement post.

Get Started Now

Go get it, it's free

If I had to code JavaScript I would use RubyJS.
Yukihiro (Matz) Matsumoto, creator of Ruby

100% JavaScript

RubyJS is built on top of JavaScript. It runs in all browsers. No additional tools needed.

Works like Ruby

Easily port code from Ruby to JavaScript. Become productive in JavaScript in hours. Fully tested with rubyspec.

Fast and small

20 kilobytes minified and gzipped. It is as fast or faster than comparable libraries.

Utility belt or OO

Use RubyJS like a utility belt, transforming arrays, string and continue with native objects. Or use the fully-fledged RubyJS objects and make use of their mutator (aka bang) methods.

All-in-one Library

String, Array, Time, Numbers, Range, and more. RubyJS gives you the power of multiple 3rd party libraries, with one coherent API. So you only have to learn, manage and update one.

Ruby Features

Block arguments, destructive (bang-) methods, duck-typing, special variables, mixins.

It's about the standard library, not writing Ruby in JS

The main motive is to have a decent standard library for JavaScript. Instead of reinventing the wheel I took something that works already and people like, the Ruby core-lib. RubyJS does not implement the class, object, metaprogramming features of Ruby. The nice side-effect is that Rubyists get an immediate production boost.

How its different form underscore, stringjs, etc

RubyJS basically includes multiple libraries in one. There is one API, dependency, documentation and one way of doing things. Methods are chainable by design and chaining works across types.

arr = ['foo', 'bar']
str = _(arr).map(function (w) { return S(w).capitalize().s })

With RubyJS: one API. One chain.

R(arr, true).map(R.proc('capitalize'))
// In most cases calling toNative() is actually not necessary.

It does it the JavaScript way

RubyJS is simply a library for standard types like String or Arrays that gives you many convenience methods. There are features that are simply included for the completeness sake and to comply with Rubyspec. And then there's also Ruby features that were not ported as they felt to unnatural.


If the above is the JavaScript way, then so is the following:



RubyJS uses lightweight wrapper objects, much like other libraries. Method arguments are smartly typecasted and are only converted to RubyJS objects when really needed. The R function is heavily optimized and causes little overhead. Wrappers can also be significantly faster than extending native classes.

© 2012 FundExplorer GmbH Back to Top