From: Robert Dober Date: 2009-08-29T06:27:22+09:00 Subject: Re: I need a string#all_indices method--is there such a thing? On Fri, Aug 28, 2009 at 4:55 PM, timr wrote: >> What about >> class String >>   def indices rgx, idx=0 >>     [].tap{ |r| >>       loop do >>         idx = index rgx, idx >>         break unless idx >>         r << idx >>         idx += 1 >>       end >>     } >>   end >> end >> > > [].tap? > you must have defined a tap method for array somewhere. But not in the > code you showed. Can't run the code without a definition for tap. > Thanks, > Tim > Sorry I am an unconditional one-niner. I really should be more careful to mark 1.9 only features with comments. At least for some more weeks ;-) -- If you tell the truth you don't have to remember anything. -- Samuel Clemens (some call him Mark Twain)