September 22, 2009
Harrumph.
I wanted to call a class method on a subclass when the base class’s inherited callback is triggered.
But it doesn’t work, because the subclass isn’t loaded when this callback is triggered.
So the following doesn’t work (’boo’ prints instead of ‘foo’):
class Base
def self.permalink
‘boo’
end
def self.inherited(c)
[...]
Read the full article →
August 20, 2009
It took awhile longer to figure this out than I would have liked, due to no on-line JavaDocs for JRuby (what’s up with that!?).
But here’s how to embed JRuby 1.9 into a Java class:
import org.jruby.Ruby;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.RubyInstanceConfig;
import org.jruby.CompatVersion;
import java.util.ArrayList;
public class JRubyEmbedded {
public static void main(String[] args) {
RubyInstanceConfig ric [...]
Read the full article →