Sha256: a20ec068a41046a12c5d647ee694e7c86943421b4da61c07531e65324b3673c8

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 Bytes

Contents

module RestCore; end
module RestCore::ParseQuery
  module_function
  begin
    require 'rack/utils'
    def parse_query(qs, d = nil)
      Rack::Utils.parse_query(qs, d)
    end
  rescue LoadError
    # Stolen from Rack
    def parse_query(qs, d = nil)
      params = {}

      (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
        k, v = p.split('=', 2).map { |x| unescape(x) }
        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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rest-core-1.0.3 lib/rest-core/util/parse_query.rb
rest-core-1.0.2 lib/rest-core/util/parse_query.rb
rest-core-1.0.1 lib/rest-core/util/parse_query.rb
rest-core-1.0.0 lib/rest-core/util/parse_query.rb
rest-core-0.8.2 lib/rest-core/util/parse_query.rb
rest-core-0.8.1 lib/rest-core/util/parse_query.rb
rest-core-0.8.0 lib/rest-core/util/parse_query.rb
rest-core-0.7.2 lib/rest-core/util/parse_query.rb