I want to pass a Java class to a JRuby method, and instantiate the class object in the method (I want a generic way of running some tests on a set of Java classes, and also need to instantiate a number of these objects, not known until runtime):
#...
somethingMethod(Bar)
#....
def somethingMethod(javaClass)
number.each do |n|
fu=javaClass.new
#...otherStuff
end
end
But this does not seem to be doable in this fashion. I get:
Failure/Error: somethingMethod(Bar)
NameError:
uninitialized constant Bar
# somethingTest.rb:45:in `(root)'
I've also tried to use the fully qualified class name: same results. Thanks.