Skip to content

Instantly share code, notes, and snippets.

@headius
Created December 28, 2012 23:38
Show Gist options
  • Save headius/4403137 to your computer and use it in GitHub Desktop.
Save headius/4403137 to your computer and use it in GitHub Desktop.
system ~/projects/rubyflux $ cat blah.rb
def method_missing(name, args)
puts name
end
foo
bar
baz
system ~/projects/rubyflux $ rake run[blah.rb]
jruby -I target:src/main/ruby src/main/ruby/ruby_flux.rb blah.rb
javac blah.java
java blah
foo
bar
baz
system ~/projects/rubyflux $ cat build/blah.java
public class blah extends RObject {
public static void main(String[] args) {
new blah().$main();
}
public void $main() {
RObject $last = RNil;
$last = foo();
$last = bar();
$last = baz();
;
}
public RObject method_missing(RObject name, RObject args) {
RObject $last = RNil;
$last = puts(name);
return $last;
}
}
system ~/projects/rubyflux $ cat build/RObject.java
class RObject extends RKernel {
public RObject method_missing(RObject arg00, RObject arg01) {
return method_missing(new RString("method_missing"), new RArray(arg00,
arg01));
}
public RObject foo() {
return method_missing(new RString("foo"), new RArray());
}
public RObject bar() {
return method_missing(new RString("bar"), new RArray());
}
public RObject baz() {
return method_missing(new RString("baz"), new RArray());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment