module Sprockets::URIUtils

def encode_uri_query_params(params)

Returns String query or nil if empty.

params - Hash of params to serialize

Internal: Serialize hash of params into query string.
def encode_uri_query_params(params)
  query = []
  params.each do |key, value|
    case value
    when Integer
      query << "#{key}=#{value}"
    when String, Symbol
      query << "#{key}=#{URI::Generic::DEFAULT_PARSER.escape(value.to_s)}"
    when TrueClass
      query << "#{key}"
    when FalseClass, NilClass
    else
      raise TypeError, "unexpected type: #{value.class}"
    end
  end
  "#{query.join('&'.freeze)}" if query.any?
end