{"action":"created","comment":{"url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/comments/224982969","pull_request_review_id":164488367,"id":224982969,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDk4Mjk2OQ==","diff_hunk":"@@ -0,0 +1,26 @@\n+require 'byebug'\n+class ConvertABinaryNumberToDecimal\n+  def self._2dec(number)\n+    return 0 if number == 0\n+    switch(number)\n+  end\n+\n+  def self.switch(number)\n+    initial_arrays = number.to_s.split(\"\")\n+    arrays = []\n+    result = []\n+    length = number.to_s.split(\"\").length - 1\n+    (0..length).to_a.each do |element|\n+      arrays << 2**element\n+    end\n+    result << initial_arrays\n+    result << arrays.reverse\n+    b = []\n+    result.transpose.each do |element|\n+      b << element[0].to_i*element[1]\n+    end\n+    b.sum\n+  end","path":"100.extend-exercise/convert-a-binary-number-to-decimal.rb","position":23,"original_position":23,"commit_id":"1265b60fbe63419f52c57a4d9de5839192215c0c","original_commit_id":"1265b60fbe63419f52c57a4d9de5839192215c0c","user":{"login":"dinhhuydh","id":883629,"node_id":"MDQ6VXNlcjg4MzYyOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/883629?v=4","gravatar_id":"","url":"https://api.github.com/users/dinhhuydh","html_url":"https://github.com/dinhhuydh","followers_url":"https://api.github.com/users/dinhhuydh/followers","following_url":"https://api.github.com/users/dinhhuydh/following{/other_user}","gists_url":"https://api.github.com/users/dinhhuydh/gists{/gist_id}","starred_url":"https://api.github.com/users/dinhhuydh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinhhuydh/subscriptions","organizations_url":"https://api.github.com/users/dinhhuydh/orgs","repos_url":"https://api.github.com/users/dinhhuydh/repos","events_url":"https://api.github.com/users/dinhhuydh/events{/privacy}","received_events_url":"https://api.github.com/users/dinhhuydh/received_events","type":"User","site_admin":false},"body":"I can't get your algorithm here. Could you explain it? The code looks complicated.","created_at":"2018-10-14T07:39:54Z","updated_at":"2018-10-14T07:39:54Z","html_url":"https://github.com/dhoangk07/exercism-ruby/pull/19#discussion_r224982969","pull_request_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/comments/224982969"},"html":{"href":"https://github.com/dhoangk07/exercism-ruby/pull/19#discussion_r224982969"},"pull_request":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19","id":221794152,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxNzk0MTUy","html_url":"https://github.com/dhoangk07/exercism-ruby/pull/19","diff_url":"https://github.com/dhoangk07/exercism-ruby/pull/19.diff","patch_url":"https://github.com/dhoangk07/exercism-ruby/pull/19.patch","issue_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/19","number":19,"state":"open","locked":false,"title":"Extend ruby/convert a binary number to decimal","user":{"login":"dhoangk07","id":32945097,"node_id":"MDQ6VXNlcjMyOTQ1MDk3","avatar_url":"https://avatars3.githubusercontent.com/u/32945097?v=4","gravatar_id":"","url":"https://api.github.com/users/dhoangk07","html_url":"https://github.com/dhoangk07","followers_url":"https://api.github.com/users/dhoangk07/followers","following_url":"https://api.github.com/users/dhoangk07/following{/other_user}","gists_url":"https://api.github.com/users/dhoangk07/gists{/gist_id}","starred_url":"https://api.github.com/users/dhoangk07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhoangk07/subscriptions","organizations_url":"https://api.github.com/users/dhoangk07/orgs","repos_url":"https://api.github.com/users/dhoangk07/repos","events_url":"https://api.github.com/users/dhoangk07/events{/privacy}","received_events_url":"https://api.github.com/users/dhoangk07/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-10T13:41:32Z","updated_at":"2018-10-14T07:39:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31ee4160c10c46ddee455ae985fc731aaad0e9b3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19/commits","review_comments_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19/comments","review_comment_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/19/comments","statuses_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/statuses/1265b60fbe63419f52c57a4d9de5839192215c0c","head":{"label":"dhoangk07:extend-ruby/convert-a-binary-number-to-decimal","ref":"extend-ruby/convert-a-binary-number-to-decimal","sha":"1265b60fbe63419f52c57a4d9de5839192215c0c","user":{"login":"dhoangk07","id":32945097,"node_id":"MDQ6VXNlcjMyOTQ1MDk3","avatar_url":"https://avatars3.githubusercontent.com/u/32945097?v=4","gravatar_id":"","url":"https://api.github.com/users/dhoangk07","html_url":"https://github.com/dhoangk07","followers_url":"https://api.github.com/users/dhoangk07/followers","following_url":"https://api.github.com/users/dhoangk07/following{/other_user}","gists_url":"https://api.github.com/users/dhoangk07/gists{/gist_id}","starred_url":"https://api.github.com/users/dhoangk07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhoangk07/subscriptions","organizations_url":"https://api.github.com/users/dhoangk07/orgs","repos_url":"https://api.github.com/users/dhoangk07/repos","events_url":"https://api.github.com/users/dhoangk07/events{/privacy}","received_events_url":"https://api.github.com/users/dhoangk07/received_events","type":"User","site_admin":false},"repo":{"id":150344258,"node_id":"MDEwOlJlcG9zaXRvcnkxNTAzNDQyNTg=","name":"exercism-ruby","full_name":"dhoangk07/exercism-ruby","private":false,"owner":{"login":"dhoangk07","id":32945097,"node_id":"MDQ6VXNlcjMyOTQ1MDk3","avatar_url":"https://avatars3.githubusercontent.com/u/32945097?v=4","gravatar_id":"","url":"https://api.github.com/users/dhoangk07","html_url":"https://github.com/dhoangk07","followers_url":"https://api.github.com/users/dhoangk07/followers","following_url":"https://api.github.com/users/dhoangk07/following{/other_user}","gists_url":"https://api.github.com/users/dhoangk07/gists{/gist_id}","starred_url":"https://api.github.com/users/dhoangk07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhoangk07/subscriptions","organizations_url":"https://api.github.com/users/dhoangk07/orgs","repos_url":"https://api.github.com/users/dhoangk07/repos","events_url":"https://api.github.com/users/dhoangk07/events{/privacy}","received_events_url":"https://api.github.com/users/dhoangk07/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dhoangk07/exercism-ruby","description":"Learning ruby on Exercism","fork":false,"url":"https://api.github.com/repos/dhoangk07/exercism-ruby","forks_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/forks","keys_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/teams","hooks_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/hooks","issue_events_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/events","assignees_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/tags","blobs_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/languages","stargazers_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/stargazers","contributors_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/contributors","subscribers_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/subscribers","subscription_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/subscription","commits_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/merges","archive_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/downloads","issues_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/labels{/name}","releases_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/deployments","created_at":"2018-09-26T00:12:49Z","updated_at":"2018-09-30T23:46:59Z","pushed_at":"2018-10-13T18:00:05Z","git_url":"git://github.com/dhoangk07/exercism-ruby.git","ssh_url":"git@github.com:dhoangk07/exercism-ruby.git","clone_url":"https://github.com/dhoangk07/exercism-ruby.git","svn_url":"https://github.com/dhoangk07/exercism-ruby","homepage":null,"size":83,"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":0,"mirror_url":null,"archived":false,"open_issues_count":24,"license":null,"forks":0,"open_issues":24,"watchers":0,"default_branch":"master"}},"base":{"label":"dhoangk07:master","ref":"master","sha":"690c69e9b369649c8616f2569278f14cdc167b7f","user":{"login":"dhoangk07","id":32945097,"node_id":"MDQ6VXNlcjMyOTQ1MDk3","avatar_url":"https://avatars3.githubusercontent.com/u/32945097?v=4","gravatar_id":"","url":"https://api.github.com/users/dhoangk07","html_url":"https://github.com/dhoangk07","followers_url":"https://api.github.com/users/dhoangk07/followers","following_url":"https://api.github.com/users/dhoangk07/following{/other_user}","gists_url":"https://api.github.com/users/dhoangk07/gists{/gist_id}","starred_url":"https://api.github.com/users/dhoangk07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhoangk07/subscriptions","organizations_url":"https://api.github.com/users/dhoangk07/orgs","repos_url":"https://api.github.com/users/dhoangk07/repos","events_url":"https://api.github.com/users/dhoangk07/events{/privacy}","received_events_url":"https://api.github.com/users/dhoangk07/received_events","type":"User","site_admin":false},"repo":{"id":150344258,"node_id":"MDEwOlJlcG9zaXRvcnkxNTAzNDQyNTg=","name":"exercism-ruby","full_name":"dhoangk07/exercism-ruby","private":false,"owner":{"login":"dhoangk07","id":32945097,"node_id":"MDQ6VXNlcjMyOTQ1MDk3","avatar_url":"https://avatars3.githubusercontent.com/u/32945097?v=4","gravatar_id":"","url":"https://api.github.com/users/dhoangk07","html_url":"https://github.com/dhoangk07","followers_url":"https://api.github.com/users/dhoangk07/followers","following_url":"https://api.github.com/users/dhoangk07/following{/other_user}","gists_url":"https://api.github.com/users/dhoangk07/gists{/gist_id}","starred_url":"https://api.github.com/users/dhoangk07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhoangk07/subscriptions","organizations_url":"https://api.github.com/users/dhoangk07/orgs","repos_url":"https://api.github.com/users/dhoangk07/repos","events_url":"https://api.github.com/users/dhoangk07/events{/privacy}","received_events_url":"https://api.github.com/users/dhoangk07/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dhoangk07/exercism-ruby","description":"Learning ruby on Exercism","fork":false,"url":"https://api.github.com/repos/dhoangk07/exercism-ruby","forks_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/forks","keys_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/teams","hooks_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/hooks","issue_events_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/events","assignees_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/tags","blobs_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/languages","stargazers_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/stargazers","contributors_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/contributors","subscribers_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/subscribers","subscription_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/subscription","commits_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/merges","archive_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/downloads","issues_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/labels{/name}","releases_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/dhoangk07/exercism-ruby/deployments","created_at":"2018-09-26T00:12:49Z","updated_at":"2018-09-30T23:46:59Z","pushed_at":"2018-10-13T18:00:05Z","git_url":"git://github.com/dhoangk07/exercism-ruby.git","ssh_url":"git@github.com:dhoangk07/exercism-ruby.git","clone_url":"https://github.com/dhoangk07/exercism-ruby.git","svn_url":"https://github.com/dhoangk07/exercism-ruby","homepage":null,"size":83,"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":0,"mirror_url":null,"archived":false,"open_issues_count":24,"license":null,"forks":0,"open_issues":24,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19"},"html":{"href":"https://github.com/dhoangk07/exercism-ruby/pull/19"},"issue":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/19"},"comments":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/dhoangk07/exercism-ruby/statuses/1265b60fbe63419f52c57a4d9de5839192215c0c"}},"author_association":"OWNER"}}
{"actor":{"display_login":"dinhhuydh"}}