On Mon, Jun 22, 2009 at 8:32 PM, Lloyd Linklater<lloyd / 2live4.com> wrote: > Hooopo wrote: > >> require'enumerator' >> qwertyuiopasdfgd".scan(/./).each_cons(3){|x,y,z| p [x,y,z].join} > > I see that it will not output anything if the scan is omitted but why is > that so? ¨Âóååíôèáô éô äïåó îïâõõó áîùôèéîç ïæ öáìõå® Because String has a somehow strange way to implement Enumerables in 1.8 and in 1.9 there is simply no String#each_cons (because String is not an enumerable anymore) Personally I think it was a good decision, forcing people to be clear how they want the String to be "iterated" as there are some possibilities "".enum_for( x ) x in each_byte, each_char and ??? as a short for that you have x.bytes --> Enumerator x.chars --> Enumerator But David has already applied this technique in one of the replies, so I might not be DRY ;) HTH Robert Cheers > -- > Posted via http://www.ruby-forum.com/. > > -- Toutes les grandes personnes ont dÃÂbord ñÕdes enfants, mais peu dÃÆntre elles sÃÆn souviennent. All adults have been children first, but not many remember. [Antoine de Saint-ExupñÓy]