{"action":"created","comment":{"url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/comments/34093929","id":34093929,"diff_hunk":"@@ -1,68 +1,211 @@\n----\n-tags: readme\n-language: ruby\n-resources: 0\n-track: web development\n-topic: ruby\n-unit: hashes\n-lesson: overview, creation, manipulation, retrieval\n----\n-\n # Hashes\n \n+## Objectives\n+\n+We're going to introduce a new data structure, one that is more complicated than arrays. Hashes will occupy us for the next several lessons and there's a lot to cover. This lesson, which includes code challenges, covers the following:\n+\n+1. Introduction: what are hashes and what do we need them for?\n+2. Creating\n+3. Retrieval\n+4. Adding Data to Hashes\n+\n+In the upcoming lessons, we'll go over how to iterate over and manipulate hashes and how to build more complex, or nested, hashes. \n+\n ## Introduction\n-* \"Hashes are a lot like arrays: they have a bunch of slots that can point to various objects. However, in an array, the slots are lined up in a row, and each one is numbered (starting from zero). In a hash, the slots aren’t in a row (they are just sort of jumbled together) and you can use any object to refer to a slot, not just a number.\" - From [Chris Pine's Learn to Program, page 108](http://books.flatironschool.com/books/43?page=108)\n+> Hashes are a lot like arrays: they have a bunch of slots that can point to various objects. However, in an array, the slots are lined up in a row, and each one is numbered (starting from zero). In a hash, the slots aren’t in a row (they are just sort of jumbled together) and you can use any object to refer to a slot, not just a number. \n+> \n+> –– [Chris Pine's Learn to Program, page 108](http://books.flatironschool.com/books/43?page=108)\n+\n+\n+Up until this point, we've stored our data in list-form using arrays. Let's take a look at an example where an array would not be sufficient to meet our storage needs.\n+\n+### Example: Customs Inspector\n+\n+![Herman Melville](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Herman_Melville.jpg/160px-Herman_Melville.jpg)\n+\n+The year is 1866 and we work beside [Herman Melville](https://en.wikipedia.org/wiki/Herman_Melville) (author of Moby Dick) as a customs inspector in New York. (I know, when did our lives become so old-timey and exciting? FYI he really did work there in 1866.) We're in charge of inspecting an incoming shipment and we need to track the items we're inspecting by listing each type of item (for example whale bone corset, porcelain, oil painting, other old fashioned item, etc) and the number of that item in the shipment. \n+\n+Let's say our shipment containts 5 whale bone corsets, 2 porcelain vases and 3 oil paintings. If we tried to store them in an array in list form, it would look like this: \n+\n+```ruby\n+old_fashioned_things = [\"whale bone corset\", \"porcelain vase\", \"oil painting\"\n+```\n+As it stands, there is no way for us to include the count of each item in a way that associates the item to it's count. That's no good. How is our co-worker Herman Melville going to be able to tell how many of each item are in this shipment? \n+\n+Here's where a hash can come in handy. With a hash, we can store a list of associated pairs. In other words, we can store the pairs of item/count. Let's take a look: \n+\n+```ruby\n+old_fashioned_things = {\n+  \"whale bone corset\" => 5, \n+  \"porcelain vase\" => 2, \n+  \"oil painting\" => 3\n+}\n+```\n \n ## Structure\n-* Hashes are structured with keys and values.\n+Hashes are structured with keys and values. Each key/value pair makes up one unit in the hash. The entire collection of key/value pairs, which are comma separated, is enclosed in curly braces, `{ }`. \n \n ```ruby\n hash = {:key => \"value\", :another_key => \"another value\"}\n ```\n \n-## Creation\n-* Making a new hash can be accomplished in a couple different ways.\n+You can think of a hash as a dictionary. The key is the reference point that is set equal to an associated value. In fact, a dictionary makes a pretty good hash example. Let's take a look: ","path":"README.md","position":null,"original_position":66,"commit_id":"92d35a43664938a29a1e0a57fc4594e2146d923d","original_commit_id":"de1481ab78c33e2769c19d33ed9d1bd2d30f0727","user":{"login":"SophieDeBenedetto","id":8999596,"avatar_url":"https://avatars.githubusercontent.com/u/8999596?v=3","gravatar_id":"","url":"https://api.github.com/users/SophieDeBenedetto","html_url":"https://github.com/SophieDeBenedetto","followers_url":"https://api.github.com/users/SophieDeBenedetto/followers","following_url":"https://api.github.com/users/SophieDeBenedetto/following{/other_user}","gists_url":"https://api.github.com/users/SophieDeBenedetto/gists{/gist_id}","starred_url":"https://api.github.com/users/SophieDeBenedetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SophieDeBenedetto/subscriptions","organizations_url":"https://api.github.com/users/SophieDeBenedetto/orgs","repos_url":"https://api.github.com/users/SophieDeBenedetto/repos","events_url":"https://api.github.com/users/SophieDeBenedetto/events{/privacy}","received_events_url":"https://api.github.com/users/SophieDeBenedetto/received_events","type":"User","site_admin":false},"body":"addressed w latest commit","created_at":"2015-07-07T21:35:19Z","updated_at":"2015-07-07T21:35:19Z","html_url":"https://github.com/learn-co-curriculum/hash-overview-readme/pull/1#discussion_r34093929","pull_request_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/comments/34093929"},"html":{"href":"https://github.com/learn-co-curriculum/hash-overview-readme/pull/1#discussion_r34093929"},"pull_request":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1","id":38991588,"html_url":"https://github.com/learn-co-curriculum/hash-overview-readme/pull/1","diff_url":"https://github.com/learn-co-curriculum/hash-overview-readme/pull/1.diff","patch_url":"https://github.com/learn-co-curriculum/hash-overview-readme/pull/1.patch","issue_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/1","number":1,"state":"open","locked":false,"title":"New readme","user":{"login":"SophieDeBenedetto","id":8999596,"avatar_url":"https://avatars.githubusercontent.com/u/8999596?v=3","gravatar_id":"","url":"https://api.github.com/users/SophieDeBenedetto","html_url":"https://github.com/SophieDeBenedetto","followers_url":"https://api.github.com/users/SophieDeBenedetto/followers","following_url":"https://api.github.com/users/SophieDeBenedetto/following{/other_user}","gists_url":"https://api.github.com/users/SophieDeBenedetto/gists{/gist_id}","starred_url":"https://api.github.com/users/SophieDeBenedetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SophieDeBenedetto/subscriptions","organizations_url":"https://api.github.com/users/SophieDeBenedetto/orgs","repos_url":"https://api.github.com/users/SophieDeBenedetto/repos","events_url":"https://api.github.com/users/SophieDeBenedetto/events{/privacy}","received_events_url":"https://api.github.com/users/SophieDeBenedetto/received_events","type":"User","site_admin":false},"body":"new readme and repl. DON'T MERGE THIS YET. repl is not in production but any day now...\r\n\r\n\r\n@jmburges @aviflombaum ","created_at":"2015-07-01T15:04:36Z","updated_at":"2015-07-07T21:35:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dcea1c0fa5387da8dd623fc2accb022cdbdfd48c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1/commits","review_comments_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1/comments","review_comment_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/1/comments","statuses_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/statuses/92d35a43664938a29a1e0a57fc4594e2146d923d","head":{"label":"learn-co-curriculum:new-readme","ref":"new-readme","sha":"92d35a43664938a29a1e0a57fc4594e2146d923d","user":{"login":"learn-co-curriculum","id":6208017,"avatar_url":"https://avatars.githubusercontent.com/u/6208017?v=3","gravatar_id":"","url":"https://api.github.com/users/learn-co-curriculum","html_url":"https://github.com/learn-co-curriculum","followers_url":"https://api.github.com/users/learn-co-curriculum/followers","following_url":"https://api.github.com/users/learn-co-curriculum/following{/other_user}","gists_url":"https://api.github.com/users/learn-co-curriculum/gists{/gist_id}","starred_url":"https://api.github.com/users/learn-co-curriculum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learn-co-curriculum/subscriptions","organizations_url":"https://api.github.com/users/learn-co-curriculum/orgs","repos_url":"https://api.github.com/users/learn-co-curriculum/repos","events_url":"https://api.github.com/users/learn-co-curriculum/events{/privacy}","received_events_url":"https://api.github.com/users/learn-co-curriculum/received_events","type":"Organization","site_admin":false},"repo":{"id":23878704,"name":"hash-overview-readme","full_name":"learn-co-curriculum/hash-overview-readme","owner":{"login":"learn-co-curriculum","id":6208017,"avatar_url":"https://avatars.githubusercontent.com/u/6208017?v=3","gravatar_id":"","url":"https://api.github.com/users/learn-co-curriculum","html_url":"https://github.com/learn-co-curriculum","followers_url":"https://api.github.com/users/learn-co-curriculum/followers","following_url":"https://api.github.com/users/learn-co-curriculum/following{/other_user}","gists_url":"https://api.github.com/users/learn-co-curriculum/gists{/gist_id}","starred_url":"https://api.github.com/users/learn-co-curriculum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learn-co-curriculum/subscriptions","organizations_url":"https://api.github.com/users/learn-co-curriculum/orgs","repos_url":"https://api.github.com/users/learn-co-curriculum/repos","events_url":"https://api.github.com/users/learn-co-curriculum/events{/privacy}","received_events_url":"https://api.github.com/users/learn-co-curriculum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/learn-co-curriculum/hash-overview-readme","description":"readme about hashes in ruby","fork":false,"url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme","forks_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/forks","keys_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/teams","hooks_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/hooks","issue_events_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/events{/number}","events_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/events","assignees_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/assignees{/user}","branches_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/branches{/branch}","tags_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/tags","blobs_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/refs{/sha}","trees_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/statuses/{sha}","languages_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/languages","stargazers_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/stargazers","contributors_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/contributors","subscribers_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/subscribers","subscription_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/subscription","commits_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/commits{/sha}","git_commits_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/commits{/sha}","comments_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/comments{/number}","issue_comment_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/comments{/number}","contents_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/contents/{+path}","compare_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/merges","archive_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/downloads","issues_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues{/number}","pulls_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls{/number}","milestones_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/milestones{/number}","notifications_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/labels{/name}","releases_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/releases{/id}","created_at":"2014-09-10T14:58:45Z","updated_at":"2015-06-22T00:47:19Z","pushed_at":"2015-07-07T21:34:56Z","git_url":"git://github.com/learn-co-curriculum/hash-overview-readme.git","ssh_url":"git@github.com:learn-co-curriculum/hash-overview-readme.git","clone_url":"https://github.com/learn-co-curriculum/hash-overview-readme.git","svn_url":"https://github.com/learn-co-curriculum/hash-overview-readme","homepage":null,"size":193,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"learn-co-curriculum:master","ref":"master","sha":"595ebddfe04a22d2c1674f8d7e76050d1657e8f5","user":{"login":"learn-co-curriculum","id":6208017,"avatar_url":"https://avatars.githubusercontent.com/u/6208017?v=3","gravatar_id":"","url":"https://api.github.com/users/learn-co-curriculum","html_url":"https://github.com/learn-co-curriculum","followers_url":"https://api.github.com/users/learn-co-curriculum/followers","following_url":"https://api.github.com/users/learn-co-curriculum/following{/other_user}","gists_url":"https://api.github.com/users/learn-co-curriculum/gists{/gist_id}","starred_url":"https://api.github.com/users/learn-co-curriculum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learn-co-curriculum/subscriptions","organizations_url":"https://api.github.com/users/learn-co-curriculum/orgs","repos_url":"https://api.github.com/users/learn-co-curriculum/repos","events_url":"https://api.github.com/users/learn-co-curriculum/events{/privacy}","received_events_url":"https://api.github.com/users/learn-co-curriculum/received_events","type":"Organization","site_admin":false},"repo":{"id":23878704,"name":"hash-overview-readme","full_name":"learn-co-curriculum/hash-overview-readme","owner":{"login":"learn-co-curriculum","id":6208017,"avatar_url":"https://avatars.githubusercontent.com/u/6208017?v=3","gravatar_id":"","url":"https://api.github.com/users/learn-co-curriculum","html_url":"https://github.com/learn-co-curriculum","followers_url":"https://api.github.com/users/learn-co-curriculum/followers","following_url":"https://api.github.com/users/learn-co-curriculum/following{/other_user}","gists_url":"https://api.github.com/users/learn-co-curriculum/gists{/gist_id}","starred_url":"https://api.github.com/users/learn-co-curriculum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learn-co-curriculum/subscriptions","organizations_url":"https://api.github.com/users/learn-co-curriculum/orgs","repos_url":"https://api.github.com/users/learn-co-curriculum/repos","events_url":"https://api.github.com/users/learn-co-curriculum/events{/privacy}","received_events_url":"https://api.github.com/users/learn-co-curriculum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/learn-co-curriculum/hash-overview-readme","description":"readme about hashes in ruby","fork":false,"url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme","forks_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/forks","keys_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/teams","hooks_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/hooks","issue_events_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/events{/number}","events_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/events","assignees_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/assignees{/user}","branches_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/branches{/branch}","tags_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/tags","blobs_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/refs{/sha}","trees_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/statuses/{sha}","languages_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/languages","stargazers_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/stargazers","contributors_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/contributors","subscribers_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/subscribers","subscription_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/subscription","commits_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/commits{/sha}","git_commits_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/git/commits{/sha}","comments_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/comments{/number}","issue_comment_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/comments{/number}","contents_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/contents/{+path}","compare_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/merges","archive_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/downloads","issues_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues{/number}","pulls_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls{/number}","milestones_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/milestones{/number}","notifications_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/labels{/name}","releases_url":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/releases{/id}","created_at":"2014-09-10T14:58:45Z","updated_at":"2015-06-22T00:47:19Z","pushed_at":"2015-07-07T21:34:56Z","git_url":"git://github.com/learn-co-curriculum/hash-overview-readme.git","ssh_url":"git@github.com:learn-co-curriculum/hash-overview-readme.git","clone_url":"https://github.com/learn-co-curriculum/hash-overview-readme.git","svn_url":"https://github.com/learn-co-curriculum/hash-overview-readme","homepage":null,"size":193,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1"},"html":{"href":"https://github.com/learn-co-curriculum/hash-overview-readme/pull/1"},"issue":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/1"},"comments":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/learn-co-curriculum/hash-overview-readme/statuses/92d35a43664938a29a1e0a57fc4594e2146d923d"}}}}