Howdy!
I’m running a JRuby script on top of a pretty hefty Java application,
and there are some cases where I’ll need to call a Java method from the
JRuby script, and have it return a bunch of objects. For example, I
might have a utility class that looks like this:
class UtilityClass {
public static String [] getStrings() {…}
}
… but if I call this from the Ruby side of things, the return value is
not recognized as an Array, and I get errors like:
NoMethodError: undefined method `join’ for
#<#Class:0x151f6292b:0x449a738a>
I’m still new to this, but that looks to me like the JRuby interpreter
has no information on the type of the return value, other than it being
a class. Any advice? I imagine I’m doing this in a strange way, and
I’m definitely not married to the idea of returning an array, as opposed
to some other Collection. I just figured that had the best chance of
working out of the box.
Thanks!
–Andy