Re: Building querystrings with ruby

}.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

On 15/03/06, Kroeger, Simon (ext) [email protected] 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs