Re: Building querystrings with ruby


#1

}.join("=") }.join("&")

Ignore my stupidity above; this is shorter and less redundant:

“?” << map{ |kv| kv.map{ |e| CGI.escape(e) }.join("=") }.join("&")

Paul.

golfing? :slight_smile:

“?#{map{|k, v| “#{CGI.escape k}=#{CGI.escape v}”} * ‘&’}”

cheers

Simon


#2

On 15/03/06, Kroeger, Simon (ext) removed_email_address@domain.invalid wrote:

golfing? :slight_smile:

“?#{map{|k, v| “#{CGI.escape k}=#{CGI.escape v}”} * ‘&’}”

All right then! :slight_smile:

“?”<<map{|h|h.map{|e|CGI.escape(e)}’=’}’&’

Paul.