lib/rack/utils.rb
# Stolen from Mongrel, with some small modifications:
# Parses a query string by breaking it up at the '&'
# and ';' characters.  You can also use this to parse
# cookies by changing the characters used in the second
# parameter (which defaults to '&;').
Stolen from Mongrel, with some small modifications:
Parses a query string by breaking it up at the '&'
and ';' characters.  You can also use this to parse
cookies by changing the characters used in the second
parameter (which defaults to '&;').
Stolen from Mongrel with some small modifications : Parses a query string by breaking it up at the ' & ' and ' ; ' characters . You can also use this to parse cookies by changing the characters used in the second parameter ( which defaults to ' & ; ' ) .
def parse_query(qs, d = '&;')
      params = {}
      (qs || '').split(/[#{d}] */n).each do |p|
        k, v = unescape(p).split('=', 2)
        if cur = params[k]
          if cur.class == Array
            params[k] << v
          else
            params[k] = [cur, v]
          end
        else
          params[k] = v
        end
      end
      return params
    end
def parse_query ( qs , d = '&;' ) params = { } ( qs || '' ) . split ( / [ #{ d } ] * /n ) . each do | p | k , v = unescape ( p ) . split ( '=' , 2 ) if cur = params [ k ] if cur . class == Array params [ k ] << v else params [ k ] = [ cur , v ] end else params [ k ] = v end end return params end
Stolen from Mongrel, with some small modifications:
Parses a query string by breaking it up at the '&'
and ';' characters.
Stolen from Mongrel with some small modifications : Parses a query string by breaking it up at the ' & ' and ' ; ' characters .
qs
d