JavaUtil.convertRubyToJava deprecated

Hi,

I need a simple mean to convert JRubyObject to their plain java
counterpart (e.g a RubyString to java.lang.String, …) . Until now i
used, JavaUtil.convertRubyToJava and i was pretty happy with it.
But now it became deprecated and no i didn’t find out a way to replace
it. What should i use ?

Thanks

On Mon, Nov 1, 2010 at 6:14 AM, Angibaud J. [email protected]
wrote:

I need a simple mean to convert JRubyObject to their plain java
counterpart (e.g a RubyString to java.lang.String, …) . Until now i
used, JavaUtil.convertRubyToJava and i was pretty happy with it.
But now it became deprecated and no i didn’t find out a way to replace
it. What should i use ?

Do you mean IRubyObject?
IRubyObject has toJava([java type]) method. For example, when you want
to convert IRubyObject to java.lang.Integer,

Integer m = (Integer)n.toJava(Integer.class)

should work.

-Yoko

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs