A Ruby static compiler.
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
RubyFlux is a compiler that turns a Ruby codebase into a closed set of .java source files suitable for running on any JVM with no additional runtime requirement.
A .java file is produced for the toplevel of each file and for each Ruby class declaration encountered. Methods are emitted as normal Java methods, but with an abstract implementation on RObject so all dynamic calls can simply be Java virtual calls. The rest of Ruby syntax maps to mostly what you'd expect in Java code.
Note that this is a young project and it is not yet considered stable for general use.
Github repository: https://github.com/headius/rubyflux
Mailing list: https://groups.google.com/forum/?fromgroups#!forum/ruby_flux
jruby -I target:src/main/ruby src/main/ruby/ruby\_flux.rb target.rb
Here's an example session for using RubyFlux today:
# The file we want to compile
$ cat fib.rb def fib(a) if a < 2 a else fib(a - 1) + fib(a - 2) end end
First need to build the compiler's jar
$ mvn package
Provide the target file to 'rake run'.
The Ruby sources are translated to .java and all support code is copied out
of RubyFlux for the compilation step. That source is then compiled and run.
$ rake run[fib.rb] jruby -I target:src/main/ruby src/main/ruby/ruby_flux.rb fib.rb javac fib.java java fib 102334155