From: Robert Klemme Date: 2008-11-04T05:18:54+09:00 Subject: Re: Clean way of pausing a loop? On 03.11.2008 21:07, Kyle Schmitt wrote: > Hum. Well those all work, but aren't those basically similar to what > I'm already doing? They at least do not do the counting manually. That's probably more efficient also since counting is done in C code. Btw, there is one more option: use each_slice. :-) > I was hoping to somehow have a handler that would inject the logic > into an existing loop. I believe we have seen such a solution in this thread already. Here's another one class EI include Enumerable def initialize(enum, steps, &inter) @enum = enum @steps = steps @inter = inter end def each @enum.each_with_index do |e,i| inter.call if i % steps == 0 && i != 0 yield e end self end end Kind regards robert