From: Gavin Sinclair Date: 2010-07-29T13:49:32+09:00 Subject: Re: Object#tap (was Nice algorithm for 'spreading' indexes across an array?) On Thu, Jul 29, 2010 at 12:40 PM, David Masover wrote: > Do this: > > string.tap {|x| x << 'foo'} > A nice use of #tap (IMO, and these things are very much a matter of opinion): message = String.new.tap { |s| s << "..." s << "..." if some_condition? s << "..." else s << "..." end end Gavin