#to_set but no #to_hash?

Hi all.

Noticed this:

ss
#Java::JavaUtil::HashMap:0x1d648e2

this map has a “to_set” method

ss.to_set.class
Set

but what I was most hoping for would be a to_hash method.

Would this be a reasonable feature request?
-r

My patch adds all Ruby Hash methods to Java’s Map type object, not
just to_hash. So, it might be too much. If my patch works for you,
I’ll try to make that feature in.

I’d be in favor of either anything in this regard.
My own personal preference would be not to even have to call
add_ruby_methods but that Map’s would gain all those methods by default.
I’m lazy :slight_smile:

-r

Hi,

On Thu, Sep 9, 2010 at 4:28 PM, Roger P. [email protected] wrote:

Set

but what I was most hoping for would be a to_hash method.

I filed http://jira.codehaus.org/browse/JRUBY-4528 with patch before.
The patch includes adding a to_hash method.
My patch adds all Ruby Hash methods to Java’s Map type object, not
just to_hash. So, it might be too much. If my patch works for you,
I’ll try to make that feature in.
Related blog post:
yokolet's notelets: Hacking JRuby - add all Hash methods to Map

-Yoko


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Sep 14, 2010 at 10:22 AM, Roger P. [email protected]
wrote:

My patch adds all Ruby Hash methods to Java’s Map type object, not
just to_hash. So, it might be too much. If my patch works for you,
I’ll try to make that feature in.

I’d be in favor of either anything in this regard.
My own personal preference would be not to even have to call
add_ruby_methods but that Map’s would gain all those methods by default.
I’m lazy :slight_smile:

Yes, it should be. That what Charles commented about. I was lazy to
develop the patch further at that time. :slight_smile: I’ll try.

-Yoko


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email