Sha256: 73ef1d2a8808bc421bae9a46a1a80e46bbeb419a6c8e4ca23be46881a9547973

Contents?: true

Size: 636 Bytes

Versions: 9

Compression:

Stored size: 636 Bytes

Contents

module RestCore; end
module RestCore::Vendor
  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

9 entries across 9 versions & 1 rubygems

Version Path
rest-core-0.7.0 lib/rest-core/util/vendor.rb
rest-core-0.4.0 lib/rest-core/util/vendor.rb
rest-core-0.4.0.pre.2 lib/rest-core/util/vendor.rb
rest-core-0.4.0.pre.1 lib/rest-core/util/vendor.rb
rest-core-0.4.0.pre.0 lib/rest-core/util/vendor.rb
rest-core-0.3.0 lib/rest-core/util/vendor.rb
rest-core-0.3.0.pre.2 lib/rest-core/util/vendor.rb
rest-core-0.3.0.pre.1 lib/rest-core/util/vendor.rb
rest-core-0.3.0.pre.0 lib/rest-core/util/vendor.rb