From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-10T08:42:30+09:00 Subject: Re: [RCR] join block On Mon, 09 Jun 2003 16:01:39 +0000, Jason Creighton wrote: > > It seems having #join take a block might be easier sometimes. And isn't Ruby > about making programming easy? This is what its all about :-) Another example where 'collect-join' could be useful I have such pieces of code everywhere in my code in order to debug. def debug $log.puts "XXX "+data.join("\nXXX ") end But it duplicates "XXX ".. not nice. I could do like this, but I think its unnecessary complicated def debug $log.puts data.collect {|d| "XXX #{d}\n"}.join end It could be written really nice using 'collect-join' def debug $log.puts data.join {|d| "XXX #{d}\n"} end -- Simon Strandgaard