Sha256: 99bbe496e15fcd85beb69336009fc24be78efcb98a752095379d73a0d43d445c

Contents?: true

Size: 477 Bytes

Versions: 5

Compression:

Stored size: 477 Bytes

Contents

# Takes a hash and converts it into a URL encoded parameter string.
#   NOTE: this does not do any uri escaping at this point, since all args should be numeric.
# @param [Hash] params Hash of params you want broken up into a query string,
#   escaped, and returned to you.
# @return [String] Escaped parameter string to append to a url.
class Hash
  def to_params(params = {})
    params[:format] = :json
    return "?#{params.each.map{ |x| x.join('=') }.join('&')}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
steam-api-1.1.0 lib/steam-api/ruby/hash.rb
steam-api-1.0.3 lib/steam-api/ruby/hash.rb
steam-api-1.0.2 lib/steam-api/ruby/hash.rb
steam-api-1.0.1 lib/steam-api/ruby/hash.rb
steam-api-1.0.0 lib/steam-api/ruby/hash.rb