This code:
wrapper = new RubyBigDecimal(runtime, (BigDecimal)obj);
produces this error in 1.1.6 but not 1.1.4:
-java.lang.AssertionError: NULL Metaclass!!?!?!-
org.jruby.RubyBasicObject.(RubyBasicObject.java:193)
org.jruby.RubyObject.(RubyObject.java:95)
org.jruby.RubyNumeric.(RubyNumeric.java:100)
org.jruby.RubyBigDecimal.(RubyBigDecimal.java:142)
ed.lang.ruby.RubyObjectWrapper.toRuby(RubyObjectWrapper.java:115)
…
What am I doing wrong?
Jim
Jim M., [email protected], [email protected]
http://www.io.com/~jimm/
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Fri, Dec 19, 2008 at 3:00 PM, Jim M. [email protected]
wrote:
org.jruby.RubyBigDecimal.(RubyBigDecimal.java:142)
ed.lang.ruby.RubyObjectWrapper.toRuby(RubyObjectWrapper.java:115)
…
What am I doing wrong?
I was not loading the bigdecimal library in my Java code. To lazily
load it when needed, I created the following static method:
/**
* Creates a RubyBigDecimal from a Java BigDecimal. Lazily loads the
Ruby
* BigDecimal class when first needed.
*/
public static RubyBigDecimal javaBigDecimalToRubyBigDecimal(Ruby
runtime, BigDecimal bd) {
if (runtime.fastGetClass(“BigDecimal”) == null) // lazily load
runtime.getLoadService().require(“bigdecimal”);
return new RubyBigDecimal(runtime, bd);
}
Jim
Jim M., [email protected], [email protected]
http://www.io.com/~jimm/
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email