What it is: Replicant is a Ruby library for automatically converting
methods on Ruby classes to Javascript classes, and serializing
instances of those classes from Ruby to Javascript using #to_json.
I’ve been developing it mostly in conjunction with some Rails
projects, but it works just fine outside of Rails, too, as long as
Prototype.js is available.
Replicant is in a pre-alpha state, though I’m using it in a couple
production apps online already.
Website: No official project page yet, but a good overview of
Replicant’s current state is at http://www.codekitchen.net/articles/
2006/07/31/replicant-technical-issues
Download: No tarball yet, anonymous Subversion access at http://
svn.codekitchen.net/replicant
= Version 0.2 (2006-08-01) (pre-alpha)
== Summary
In the process of working on a few of my recent web projects (a
couple Rails, one straight Ruby/CGI) I’ve begun writing a Ruby
library for automatic translation of Ruby classes to Javascript
classes. I’ve been trying to make my AJAX-driven apps more
responsive, which basically means making fewer calls to the server,
and it was bugging me that I was repeatedly writing a Ruby class,
only to then write another class in Javascript with the same name and
sometimes even some of the same methods.
Replicant is still in a very early state, but to be honest I’m not
sure if it’s much more than a cool toy, so I want to release it to
the Ruby community and see where people find it useful, if at all.
Any feedback (what you like about it, what you don’t like, how you
might use it in your projects) will be very appreciated.
Only a limited subset of Ruby syntax is supported right now, see my
journal article linked above and the replicant.rb source comments for
details on what can’t be done. I’ve basically added support for
syntax as I’ve needed it, so it’s pretty random what works and what
doesn’t. (i.e., support for the Enumerable mixin and yield
work,
but simple while-loops don’t.)
== Aknowledgement
- I can’t take much of the credit, the real work is done in ParseTree
and SexpProcessor. Thanks to Ryan D. and Eric H. for an awesome
library.