Hi all,
After 9 months, the second incarnation of RubyJS is out (a complete rewrite). RubyJS compiles Ruby to Javascript and tries to be as efficient as possible
without sacrifying Ruby's beauty.
This is a pre-release. I hope I can import some local code that lies here around till RubyConf.
A small example:
# hw.rb
require 'rwt/DOM'
class HelloWorld
def self.main
out = DOM.getElementById('out')
DOM.setInnerText(out, 'hello world')
end
end
<!-- index.html -->
<html>
<body>
<script src="hw.js"></script>
<a href="#" onclick="main()">say hello</a>
<div id="out"/>
</body>
</html>
Compile it:
rubyjs_gen --main HelloWorld hw.rb > hw.js
And start index.html inside your browser.
Oh, and don't forget the optimization flags:
rubyjs_gen --show-options
What works?
···
===========
* Most if not all Ruby constructs!
* Accessing/modifying DOM in your browser
* JSON
What is missing?
* The port of Google Web Toolkit is not yet completed.
* Applications
* A lot of methods in the core library
DOWNLOAD
It's available from:
http://ntecs.de/hg-projects/rubyjs/
Best use Mercurial (www.selenic.com/mercurial) to check it out:
hg clone static-http://ntecs.de/hg-projects/rubyjs/
Have fun and see you at RubyConf!
Regards,
Michael