Ordered Enumerable#group_by ?

Hi!

the changeset 3727 removed the ordering on Enumerable::group_by (it now returns a Hash, instead of the Array previously, to be closer from the Ruby 1.9 behaviour).

Is there any plan to add an ordered version back into the core ?

Thibaut

No plans that I know of. In the one app where I need the ordering to be
preserved, I just redefined group_by to use the Array version. Another
option is to call sort_by on the result but that can get ugly.

marcel

No plans that I know of. In the one app where I need the ordering to be
preserved, I just redefined group_by to use the Array version. Another
option is to call sort_by on the result but that can get ugly.

ok then, I'll keep my own copy.

thanks!

Thibaut

Cross your fingers for a native ordered hash (of whatever ilk, so long as it’s convenient :wink:

jeremy

check out dictionary.rb from ruby facets library…

http://pastie.caboo.se/9128