From: "Kroeger, Simon (ext)" Date: 2006-03-15T19:08:54+09:00 Subject: Re: Building querystrings with ruby > -----Original Message----- > From: Paul Battley [mailto:pbattley@gmail.com] > Sent: Wednesday, March 15, 2006 10:09 AM > To: ruby-talk ML > Subject: Re: Building querystrings with ruby > > On 15/03/06, Paul Battley wrote: > > And this is shorter still: > > > > "?" << to_hash.map{ |kv| kv.map{ |e| CGI.escape(e) > }.join("=") }.join("&") > > Ignore my stupidity above; this is shorter and less redundant: > > "?" << map{ |kv| kv.map{ |e| CGI.escape(e) }.join("=") }.join("&") > > Paul. golfing? :) "?#{map{|k, v| "#{CGI.escape k}=#{CGI.escape v}"} * '&'}" cheers Simon