Created
June 10, 2013 22:16
-
-
Save surrealdetective/5752909 to your computer and use it in GitHub Desktop.
hash practice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Hashes for the following use-cases. | |
# A movie collection that organizes by genres | |
movie_genre = { | |
:anime => ['The Girl Who Leapt Through Time', "Akira"], | |
:comedy => ['Bernie', 'Zoolander'], | |
:action => ['The Matrix'] | |
} | |
# Recipes with ingredients | |
recipes = { | |
:avocado => { | |
:ingredients => ['avocado', 'cayenne pepper', 'salt', 'pepper'], | |
:instructions => ['cut', 'place', 'season'] | |
}, | |
:shake => { | |
:ingredients => ['strawberry', 'banana'], | |
:instructions => ['blend'] | |
}, | |
:salad => { | |
:ingredients => ['salt', 'kale', 'apple', 'carrot', 'walnut'], | |
:instructions => ['mix'] | |
} | |
} | |
# User profiles where each user has a list of favorite colors along with 3 personal essays, essay_1, essay_2, essay_3 | |
user_profile = { | |
:alex => { | |
:favorite_colors => ['red', 'black', 'orange'], | |
:essay_1 => 'I rule', | |
:essay_2 => "What's up!", | |
:essay_3 => 'Everything!!' | |
}, | |
:dan => { | |
:favorite_colors => ['purple', 'yellow'], | |
:essay_1 => 'I love design', | |
:essay_2 => 'I love nyc', | |
:essay_3 => 'I love marie' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment