From: George Ogata Date: 2004-04-09T12:04:16+09:00 Subject: Re: new method(?) collect_by Kristof Bastiaensen writes: > Hi, I have written a method collect_by. > I am not sure if it already exist, but it is very > usefull. It is a generic version of collect, that > works with any method. Basicly it converts the output > of any block to an Array [...] You might be interested in enumerator.rb in the std lib: irb(main):001:0> require 'enumerator' => true irb(main):002:0> 'a string'.enum_for(:each_byte).map{|x| x} => [97, 32, 115, 116, 114, 105, 110, 103] irb(main):003:0> 'a string'.enum_for(:each_byte).max => 116 irb(main):004:0> 'a string'.enum_for(:each_byte).inject{|x,y| x+y} => 792 etc.