Ruby Development Exercise: Converting a Hash to a URL Friendly String in Ruby


This coding exercise walks through how to convert a Ruby hash to a URL friendly string, including how to organize the parameters.


Create a hash converter method that converts a hash to a URL friendly string.

Exercise File

Code File

Exercise Description

Given any number of hash items, such as:

hash = { :topic => "baseball", :team => "astros" }

Convert the hash keys and values into a URL friendly parameter string.

Sample Output


Real World Usage

This is a process that you will use in a few scenarios. Most importantly, working through this exercise will teach you how you can manipulate keys and values inside of a hash and how to convert them into strings. Additionally, this process is important whenever you’re working with URL parameter values.


Can be found on the solutions branch on github.


Please enter your comment!
Please enter your name here