From: Greg Hauptmann Date: 2007-02-16T05:24:04+09:00 Subject: Re: within a block passed to "each" can I detect the last time the block is called? ------=_Part_138345_25860607.1171571042538 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline excellent - thanks James! On 2/16/07, James Edward Gray II wrote: > > On Feb 15, 2007, at 1:49 PM, Greg Hauptmann wrote: > > > Does anyone know a way for the below code, to tell when the last > > block is > > called via "each" so that I can detect this and not add a > > superfluous "&" to > > the end of the string being built up? > > Doesn't exactly answer your question, but: > > > postDataHash.each { |key, value| > > postDataString << "#{key}=#{value}&" > > } > > postDataString << postDataHash.map { |k, v| "#{k}=#{v}" }.join("&") > > James Edward Gray II > > ------=_Part_138345_25860607.1171571042538--