On Fri, Mar 19, 2010 at 4:29 AM, Urabe Shyouhei <shyouhei / ruby-lang.org> wrote:
> 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 }
> => {0=>[0, 15, 35], 1=>[100], 2=>[205], 3=>[300]}

This does not solve the problem.

irb(main):011:0> [0,15,35,99,100,205,300].group_by{|i| i/100}
=> {0=>[0, 15, 35, 99], 1=>[100], 2=>[205], 3=>[300]}

but should be

[[0, 15, 35], [99, 100], [205], [300]]

at least if I understood the problem correctly.

-- 
Roger Braun
http://yononaka.de
roger.braun / student.uni-tuebingen.de