From: Urabe Shyouhei Date: 2010-03-19T12:29:23+09:00 Subject: Re: Grouping elements of an array --------------enig1E33D4B1CCF627B343C71A4A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Roger Braun wrote: > How about this: You should really know about Enumerable#group_by. irb(main):001:0> [0,15,35,100,205,300].group_by {|i| i/100 } =3D> {0=3D>[0, 15, 35], 1=3D>[100], 2=3D>[205], 3=3D>[300]} --------------enig1E33D4B1CCF627B343C71A4A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkui744ACgkQuTXPUnA5eMJRHwCgmugo6YEUiAwUE4BquCzJjQfz okkAn042fxvRHY6qj0VT8PeeLY93Y+TN =hteb -----END PGP SIGNATURE----- --------------enig1E33D4B1CCF627B343C71A4A--