Use irb, a script, or object oriented class to convert the following string into a Hash
with the given rules.
"first_name=Ada&last_name=Lovelace&dob=1815&title=Countess"
- Separate each element on the
&
characters. - Separate key and value on the
=
character
Partial Example: {first_name: "Ada", last_name: "Lovelace"}
"name=Ada*Lovelace&father=Lord*Byron&mother=Anne*Isabella*Milbanke"
- Rules from Bronze
- Convert any
*
characters into a space character
Partial Example: {name: "Ada Lovelace"}
Create a nested hash by separating the following into hashes
"person[first_name]=Ada&person[last_name]=Lovelace¢ury=19th&topic=analytical*engine"
- Rules from Bronze and Silver
[*]
indicates a hash as a value, the word preceding the[*]
is the key to the value and the word in the[*]
is a key within the nested hash.
Partial Example: {person: {first_name: "Ada", last_name: "Lovelace"}}
"person[first_name]=Ada&person[last_name]=Lovelace&skills[]=programming&skills[]=math"
- Rules from Bronze, Silver, and Gold
- An empty
[]
indicates an Array as a value. the word preceding the[]
is the key to the Array the word after the=
will be added to the array.
Partial Example: {skills: ["programming", "math"]}