{"action":"created","comment":{"url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/comments/212127179","pull_request_review_id":148694265,"id":212127179,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjEyNzE3OQ==","diff_hunk":"@@ -38,6 +38,95 @@ def initialize\n                     \"9\" => \"----.\",\n                     \"0\" => \"-----\",\n                     \" \" => \" \"}\n+                  # # Handling spaces in encrypted message (iteration 4)\n+                  # \"!\" => \"! \"}\n   end\n \n+\n+  def translate(string)\n+    converted = convert_case(string)\n+    encrypted = encrypt(converted)\n+    return encrypted\n+  end\n+\n+  def encrypt(string)\n+    characters = string.chars\n+    changed = characters.map do |char|\n+      @dictionary[char]\n+    end\n+    translated = changed.join\n+    return translated\n+  end\n+\n+  def convert_case(string)\n+    string.downcase\n+  end\n+\n+  # #######################################\n+\n+  def morse_to_eng(encrypted)\n+    formatted = manage_message_spaces(encrypted)\n+    # binding.pry\n+    letters = english_letters(formatted)\n+    # binding.pry\n+    return letters\n+  end\n+\n+  ## # takes a string\n+  # takes an array\n+  def english_letters(formatted)\n+    # formatted.compact\n+    letttters = formatted.slice(nil)\n+    binding.pry\n+    # letttters is an array of multi-dig letters\n+\n+    # WAS REWORKING THIS\n+\n+    # formatted: \".... . .-.. .-.. --- .-- --- .-. .-.. -..\"\n+    digits = formatted.split(\" \")\n+    # digits = formatted.chars\n+    binding.pry\n+    values = @dictionary.values\n+\n+    eng_letters = digits.map do |dig|\n+      letter = reverse_lookup(dig) + \" \"\n+\n+    end\n+    english = eng_letters.join\n+    # binding.pry\n+    return english\n+  end\n+\n+  # takes a letter (string size 1)\n+  def reverse_lookup(letter_encryption)\n+    keys = @dictionary.keys\n+    values = @dictionary.values\n+    index = values.index(letter_encryption)\n+    eng_letter = keys[index]\n+    # binding.pry\n+  end\n+\n+  # takes a string  (STEP 1)\n+  def manage_message_spaces(string)\n+    # JUST SLICE AT nil  ---> .compact?\n+    chars = string.chars\n+    index = 0\n+    altered = []\n+    while index < chars.size\n+      if chars[index] == \" \" && chars[index+1] == \" \"\n+        altered << chars[index] = nil\n+        index += 1\n+      else\n+        altered << chars[index]\n+        index += 1\n+      end\n+    end","path":"lib/morse_translator.rb","position":86,"original_position":86,"commit_id":"da5d2802516b7dc4f9f90312f91aa9bd9c280154","original_commit_id":"da5d2802516b7dc4f9f90312f91aa9bd9c280154","user":{"login":"BrianZanti","id":8962411,"node_id":"MDQ6VXNlcjg5NjI0MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/8962411?v=4","gravatar_id":"","url":"https://api.github.com/users/BrianZanti","html_url":"https://github.com/BrianZanti","followers_url":"https://api.github.com/users/BrianZanti/followers","following_url":"https://api.github.com/users/BrianZanti/following{/other_user}","gists_url":"https://api.github.com/users/BrianZanti/gists{/gist_id}","starred_url":"https://api.github.com/users/BrianZanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrianZanti/subscriptions","organizations_url":"https://api.github.com/users/BrianZanti/orgs","repos_url":"https://api.github.com/users/BrianZanti/repos","events_url":"https://api.github.com/users/BrianZanti/events{/privacy}","received_events_url":"https://api.github.com/users/BrianZanti/received_events","type":"User","site_admin":false},"body":"What you can do instead is split on the double space","created_at":"2018-08-22T22:13:37Z","updated_at":"2018-08-22T22:13:38Z","html_url":"https://github.com/turingschool-examples/morse_translator/pull/28#discussion_r212127179","pull_request_url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/comments/212127179"},"html":{"href":"https://github.com/turingschool-examples/morse_translator/pull/28#discussion_r212127179"},"pull_request":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28","id":210264802,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMjY0ODAy","html_url":"https://github.com/turingschool-examples/morse_translator/pull/28","diff_url":"https://github.com/turingschool-examples/morse_translator/pull/28.diff","patch_url":"https://github.com/turingschool-examples/morse_translator/pull/28.patch","issue_url":"https://api.github.com/repos/turingschool-examples/morse_translator/issues/28","number":28,"state":"open","locked":false,"title":"Kate R - wk2 - independent challenge - Morse Translator","user":{"login":"Kate-v2","id":36523304,"node_id":"MDQ6VXNlcjM2NTIzMzA0","avatar_url":"https://avatars3.githubusercontent.com/u/36523304?v=4","gravatar_id":"","url":"https://api.github.com/users/Kate-v2","html_url":"https://github.com/Kate-v2","followers_url":"https://api.github.com/users/Kate-v2/followers","following_url":"https://api.github.com/users/Kate-v2/following{/other_user}","gists_url":"https://api.github.com/users/Kate-v2/gists{/gist_id}","starred_url":"https://api.github.com/users/Kate-v2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kate-v2/subscriptions","organizations_url":"https://api.github.com/users/Kate-v2/orgs","repos_url":"https://api.github.com/users/Kate-v2/repos","events_url":"https://api.github.com/users/Kate-v2/events{/privacy}","received_events_url":"https://api.github.com/users/Kate-v2/received_events","type":"User","site_admin":false},"body":"Commit - 96b28f1 -  is through iteration 3 and works.\r\nIteration 4 is in the WIP commits. It's broken and was being reworked, but is close.","created_at":"2018-08-22T21:06:48Z","updated_at":"2018-08-22T22:13:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ededfeb938e05a4065d6841d5b5f551931547da6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28/commits","review_comments_url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28/comments","review_comment_url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/turingschool-examples/morse_translator/issues/28/comments","statuses_url":"https://api.github.com/repos/turingschool-examples/morse_translator/statuses/da5d2802516b7dc4f9f90312f91aa9bd9c280154","head":{"label":"Kate-v2:master","ref":"master","sha":"da5d2802516b7dc4f9f90312f91aa9bd9c280154","user":{"login":"Kate-v2","id":36523304,"node_id":"MDQ6VXNlcjM2NTIzMzA0","avatar_url":"https://avatars3.githubusercontent.com/u/36523304?v=4","gravatar_id":"","url":"https://api.github.com/users/Kate-v2","html_url":"https://github.com/Kate-v2","followers_url":"https://api.github.com/users/Kate-v2/followers","following_url":"https://api.github.com/users/Kate-v2/following{/other_user}","gists_url":"https://api.github.com/users/Kate-v2/gists{/gist_id}","starred_url":"https://api.github.com/users/Kate-v2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kate-v2/subscriptions","organizations_url":"https://api.github.com/users/Kate-v2/orgs","repos_url":"https://api.github.com/users/Kate-v2/repos","events_url":"https://api.github.com/users/Kate-v2/events{/privacy}","received_events_url":"https://api.github.com/users/Kate-v2/received_events","type":"User","site_admin":false},"repo":{"id":145751324,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU3NTEzMjQ=","name":"morse_translator","full_name":"Kate-v2/morse_translator","owner":{"login":"Kate-v2","id":36523304,"node_id":"MDQ6VXNlcjM2NTIzMzA0","avatar_url":"https://avatars3.githubusercontent.com/u/36523304?v=4","gravatar_id":"","url":"https://api.github.com/users/Kate-v2","html_url":"https://github.com/Kate-v2","followers_url":"https://api.github.com/users/Kate-v2/followers","following_url":"https://api.github.com/users/Kate-v2/following{/other_user}","gists_url":"https://api.github.com/users/Kate-v2/gists{/gist_id}","starred_url":"https://api.github.com/users/Kate-v2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kate-v2/subscriptions","organizations_url":"https://api.github.com/users/Kate-v2/orgs","repos_url":"https://api.github.com/users/Kate-v2/repos","events_url":"https://api.github.com/users/Kate-v2/events{/privacy}","received_events_url":"https://api.github.com/users/Kate-v2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kate-v2/morse_translator","description":null,"fork":true,"url":"https://api.github.com/repos/Kate-v2/morse_translator","forks_url":"https://api.github.com/repos/Kate-v2/morse_translator/forks","keys_url":"https://api.github.com/repos/Kate-v2/morse_translator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kate-v2/morse_translator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kate-v2/morse_translator/teams","hooks_url":"https://api.github.com/repos/Kate-v2/morse_translator/hooks","issue_events_url":"https://api.github.com/repos/Kate-v2/morse_translator/issues/events{/number}","events_url":"https://api.github.com/repos/Kate-v2/morse_translator/events","assignees_url":"https://api.github.com/repos/Kate-v2/morse_translator/assignees{/user}","branches_url":"https://api.github.com/repos/Kate-v2/morse_translator/branches{/branch}","tags_url":"https://api.github.com/repos/Kate-v2/morse_translator/tags","blobs_url":"https://api.github.com/repos/Kate-v2/morse_translator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kate-v2/morse_translator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kate-v2/morse_translator/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kate-v2/morse_translator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kate-v2/morse_translator/statuses/{sha}","languages_url":"https://api.github.com/repos/Kate-v2/morse_translator/languages","stargazers_url":"https://api.github.com/repos/Kate-v2/morse_translator/stargazers","contributors_url":"https://api.github.com/repos/Kate-v2/morse_translator/contributors","subscribers_url":"https://api.github.com/repos/Kate-v2/morse_translator/subscribers","subscription_url":"https://api.github.com/repos/Kate-v2/morse_translator/subscription","commits_url":"https://api.github.com/repos/Kate-v2/morse_translator/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kate-v2/morse_translator/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kate-v2/morse_translator/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kate-v2/morse_translator/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kate-v2/morse_translator/contents/{+path}","compare_url":"https://api.github.com/repos/Kate-v2/morse_translator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kate-v2/morse_translator/merges","archive_url":"https://api.github.com/repos/Kate-v2/morse_translator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kate-v2/morse_translator/downloads","issues_url":"https://api.github.com/repos/Kate-v2/morse_translator/issues{/number}","pulls_url":"https://api.github.com/repos/Kate-v2/morse_translator/pulls{/number}","milestones_url":"https://api.github.com/repos/Kate-v2/morse_translator/milestones{/number}","notifications_url":"https://api.github.com/repos/Kate-v2/morse_translator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kate-v2/morse_translator/labels{/name}","releases_url":"https://api.github.com/repos/Kate-v2/morse_translator/releases{/id}","deployments_url":"https://api.github.com/repos/Kate-v2/morse_translator/deployments","created_at":"2018-08-22T19:06:09Z","updated_at":"2018-08-22T21:02:16Z","pushed_at":"2018-08-22T21:02:15Z","git_url":"git://github.com/Kate-v2/morse_translator.git","ssh_url":"git@github.com:Kate-v2/morse_translator.git","clone_url":"https://github.com/Kate-v2/morse_translator.git","svn_url":"https://github.com/Kate-v2/morse_translator","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"turingschool-examples:master","ref":"master","sha":"eb586ae8654eb609fc4f7e822fb68b574408f0f8","user":{"login":"turingschool-examples","id":8518346,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1MTgzNDY=","avatar_url":"https://avatars3.githubusercontent.com/u/8518346?v=4","gravatar_id":"","url":"https://api.github.com/users/turingschool-examples","html_url":"https://github.com/turingschool-examples","followers_url":"https://api.github.com/users/turingschool-examples/followers","following_url":"https://api.github.com/users/turingschool-examples/following{/other_user}","gists_url":"https://api.github.com/users/turingschool-examples/gists{/gist_id}","starred_url":"https://api.github.com/users/turingschool-examples/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turingschool-examples/subscriptions","organizations_url":"https://api.github.com/users/turingschool-examples/orgs","repos_url":"https://api.github.com/users/turingschool-examples/repos","events_url":"https://api.github.com/users/turingschool-examples/events{/privacy}","received_events_url":"https://api.github.com/users/turingschool-examples/received_events","type":"Organization","site_admin":false},"repo":{"id":145746196,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU3NDYxOTY=","name":"morse_translator","full_name":"turingschool-examples/morse_translator","owner":{"login":"turingschool-examples","id":8518346,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1MTgzNDY=","avatar_url":"https://avatars3.githubusercontent.com/u/8518346?v=4","gravatar_id":"","url":"https://api.github.com/users/turingschool-examples","html_url":"https://github.com/turingschool-examples","followers_url":"https://api.github.com/users/turingschool-examples/followers","following_url":"https://api.github.com/users/turingschool-examples/following{/other_user}","gists_url":"https://api.github.com/users/turingschool-examples/gists{/gist_id}","starred_url":"https://api.github.com/users/turingschool-examples/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turingschool-examples/subscriptions","organizations_url":"https://api.github.com/users/turingschool-examples/orgs","repos_url":"https://api.github.com/users/turingschool-examples/repos","events_url":"https://api.github.com/users/turingschool-examples/events{/privacy}","received_events_url":"https://api.github.com/users/turingschool-examples/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/turingschool-examples/morse_translator","description":null,"fork":false,"url":"https://api.github.com/repos/turingschool-examples/morse_translator","forks_url":"https://api.github.com/repos/turingschool-examples/morse_translator/forks","keys_url":"https://api.github.com/repos/turingschool-examples/morse_translator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/turingschool-examples/morse_translator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/turingschool-examples/morse_translator/teams","hooks_url":"https://api.github.com/repos/turingschool-examples/morse_translator/hooks","issue_events_url":"https://api.github.com/repos/turingschool-examples/morse_translator/issues/events{/number}","events_url":"https://api.github.com/repos/turingschool-examples/morse_translator/events","assignees_url":"https://api.github.com/repos/turingschool-examples/morse_translator/assignees{/user}","branches_url":"https://api.github.com/repos/turingschool-examples/morse_translator/branches{/branch}","tags_url":"https://api.github.com/repos/turingschool-examples/morse_translator/tags","blobs_url":"https://api.github.com/repos/turingschool-examples/morse_translator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/turingschool-examples/morse_translator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/turingschool-examples/morse_translator/git/refs{/sha}","trees_url":"https://api.github.com/repos/turingschool-examples/morse_translator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/turingschool-examples/morse_translator/statuses/{sha}","languages_url":"https://api.github.com/repos/turingschool-examples/morse_translator/languages","stargazers_url":"https://api.github.com/repos/turingschool-examples/morse_translator/stargazers","contributors_url":"https://api.github.com/repos/turingschool-examples/morse_translator/contributors","subscribers_url":"https://api.github.com/repos/turingschool-examples/morse_translator/subscribers","subscription_url":"https://api.github.com/repos/turingschool-examples/morse_translator/subscription","commits_url":"https://api.github.com/repos/turingschool-examples/morse_translator/commits{/sha}","git_commits_url":"https://api.github.com/repos/turingschool-examples/morse_translator/git/commits{/sha}","comments_url":"https://api.github.com/repos/turingschool-examples/morse_translator/comments{/number}","issue_comment_url":"https://api.github.com/repos/turingschool-examples/morse_translator/issues/comments{/number}","contents_url":"https://api.github.com/repos/turingschool-examples/morse_translator/contents/{+path}","compare_url":"https://api.github.com/repos/turingschool-examples/morse_translator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/turingschool-examples/morse_translator/merges","archive_url":"https://api.github.com/repos/turingschool-examples/morse_translator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/turingschool-examples/morse_translator/downloads","issues_url":"https://api.github.com/repos/turingschool-examples/morse_translator/issues{/number}","pulls_url":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls{/number}","milestones_url":"https://api.github.com/repos/turingschool-examples/morse_translator/milestones{/number}","notifications_url":"https://api.github.com/repos/turingschool-examples/morse_translator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/turingschool-examples/morse_translator/labels{/name}","releases_url":"https://api.github.com/repos/turingschool-examples/morse_translator/releases{/id}","deployments_url":"https://api.github.com/repos/turingschool-examples/morse_translator/deployments","created_at":"2018-08-22T18:16:33Z","updated_at":"2018-08-22T18:56:53Z","pushed_at":"2018-08-22T21:22:55Z","git_url":"git://github.com/turingschool-examples/morse_translator.git","ssh_url":"git@github.com:turingschool-examples/morse_translator.git","clone_url":"https://github.com/turingschool-examples/morse_translator.git","svn_url":"https://github.com/turingschool-examples/morse_translator","homepage":null,"size":1,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":31,"license":null,"forks":31,"open_issues":31,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28"},"html":{"href":"https://github.com/turingschool-examples/morse_translator/pull/28"},"issue":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/issues/28"},"comments":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/turingschool-examples/morse_translator/statuses/da5d2802516b7dc4f9f90312f91aa9bd9c280154"}},"author_association":"NONE"}}
{"actor":{"display_login":"BrianZanti"}}