I have in my Java class a variable of type IRubyObject, which actually
points to a RubyObject:
// Java
RubyObject ro = get_it_from_somewhere();
....
IRubyObject iro = ro;
The RubyObject holds an object of some Ruby class, and this class in
turn has a method expecting one parameter (which is supposed to be a
string):
# Ruby
def myfunc(msg)
....
end
I want to invoke this method from Java, and I’m not interested in the
return value. This is my code:
// Java
Ruby runtime = iro.getRuntime();
ThreadContext currentContext = runtime.getCurrentContext();
iro.callMethod(currentContext, "myfunc",
JavaEmbedUtils.javaToRuby(runtime, “string passed to myfunc”));
My question: Is it possible to code this a bit simpler?