JS.Class – JavaScript in a Ruby Style
JS.Class is an attempt at making JavaScript more Ruby-like. More specifically, it's a library that makes object oriented development easier in JavaScript (in comparison to JS's prototype technique, at least) by implementing Ruby's core object, module, and class systems as well as some of Ruby's meta-programming techniques.
As well as ports of Enumerable, Observable, Comparable, and Forwardable, you get subclassing, mixins, reflection, late-binding arguments, singleton methods, method binding, and Ruby-like inheritance. Of course, JavaScript gives access to many of these elements already, but JS.Class presents things with a Ruby flavor.
The official JS.Class site is particularly well done and each main area is well documented.
September 26, 2008 at 11:15 am
This looks like an excellent library. Whilst Prototype has some Ruby influences it's always great to see a different take. The JS.StackTrace utility class looks especially useful for debugging.
September 29, 2008 at 1:47 pm
For an alternative check out Joose
Also it isn't tied into Prototype which I think is a good thing ;-)
/I3az/
October 2, 2008 at 10:11 am
Hi guys, thanks for the plug, very much appreciated. Just wanted to point out that JS.Class is not tied to Prototype, it has no external dependencies on other JS libraries. I assume Alex was drawing a comparison, but if the site gives the impression that Prototype is required, do let me know where so I can correct it.