... bytes and babes of JRuby


JewelRuby's bits and pieces are composed by @kares ('s mostly left hand).

For some the desired to write down notes on occasional experiments going on here there and all-over. Thus here we are - learning along!

JRuby the precious jewel, the most ambitious JVM language - colliding 2 worlds like no other ever before, brought to us by the ever magnificent JRuby Team.

require 'jruby/core_ext'
class Jay
  java_signature 'void greet(java.lang.String)'
  def greet(name)
    java.lang.System.out.println "Hello #{name}!"
java_class = Jay.become_java! # a java.lang.Class
out = java.lang.System.out
def out.println(str)
  super str.sub('Hello', 'Ahoja')
java_class.newInstance.greet 'World'

p.s. … feel the Joy and remember, it’s all Just Ruby (served with 0xCAFEBABE ) !