GitHub PullRequestReviewCommentEvent at 2014-10-29 10:10:37
Repository: bencoder
Actor: kholbekj
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/kholbekj/bencoder/pulls/comments/19528426","id":19528426,"diff_hunk":"@@ -3,136 +3,162 @@\n class InvalidEncodingError < StandardError; end\n class UnencodableTypeError < StandardError; end\n \n-class BEncoder\n-  class << self\n-    def encode(object)\n-      case object\n-      when Symbol\n-        encode object.to_s\n-      when String\n-        encode_string object\n-      when Integer\n-        encode_int object\n-      when Array\n-        encode_array object\n-      when Hash\n-        encode_hash object\n-      else\n-        raise UnencodableTypeError, \"Cannot encode instance of type #{object.class}\"\n-      end\n-    end\n-\n-    def decode(string)    \n-      parse string\n+class Decoder\n+  attr_reader :string\n+  \n+  def self.parse(string)\n+    new(string).parse\n+  end\n+  \n+  def initialize(string)\n+    @string = string\n+  end\n+  \n+  def parse\n+    case string[0]\n+    when 'i'\n+      parse_int string\n+    when 'l'\n+      parse_list string\n+    when 'd'\n+      parse_dict string\n+    else\n+      parse_string string\n     end\n+  end\n \n+protected","path":"lib/bencoder.rb","position":49,"original_position":49,"commit_id":"06961d67307b5e39fd0fc50d1192fcc6380137d7","original_commit_id":"06961d67307b5e39fd0fc50d1192fcc6380137d7","user":{"login":"kholbekj","id":2786571,"avatar_url":"https://avatars.githubusercontent.com/u/2786571?v=2","gravatar_id":"","url":"https://api.github.com/users/kholbekj","html_url":"https://github.com/kholbekj","followers_url":"https://api.github.com/users/kholbekj/followers","following_url":"https://api.github.com/users/kholbekj/following{/other_user}","gists_url":"https://api.github.com/users/kholbekj/gists{/gist_id}","starred_url":"https://api.github.com/users/kholbekj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kholbekj/subscriptions","organizations_url":"https://api.github.com/users/kholbekj/orgs","repos_url":"https://api.github.com/users/kholbekj/repos","events_url":"https://api.github.com/users/kholbekj/events{/privacy}","received_events_url":"https://api.github.com/users/kholbekj/received_events","type":"User","site_admin":false},"body":"Why protected? These are as far as I can see private methods.","created_at":"2014-10-29T10:10:37Z","updated_at":"2014-10-29T10:10:37Z","html_url":"https://github.com/kholbekj/bencoder/pull/1#discussion_r19528426","pull_request_url":"https://api.github.com/repos/kholbekj/bencoder/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/kholbekj/bencoder/pulls/comments/19528426"},"html":{"href":"https://github.com/kholbekj/bencoder/pull/1#discussion_r19528426"},"pull_request":{"href":"https://api.github.com/repos/kholbekj/bencoder/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/kholbekj/bencoder/pulls/1","id":22978312,"html_url":"https://github.com/kholbekj/bencoder/pull/1","diff_url":"https://github.com/kholbekj/bencoder/pull/1.diff","patch_url":"https://github.com/kholbekj/bencoder/pull/1.patch","issue_url":"https://api.github.com/repos/kholbekj/bencoder/issues/1","number":1,"state":"open","locked":false,"title":"Split functionality into two, distinct classes","user":{"login":"ekampp","id":40206,"avatar_url":"https://avatars.githubusercontent.com/u/40206?v=2","gravatar_id":"","url":"https://api.github.com/users/ekampp","html_url":"https://github.com/ekampp","followers_url":"https://api.github.com/users/ekampp/followers","following_url":"https://api.github.com/users/ekampp/following{/other_user}","gists_url":"https://api.github.com/users/ekampp/gists{/gist_id}","starred_url":"https://api.github.com/users/ekampp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekampp/subscriptions","organizations_url":"https://api.github.com/users/ekampp/orgs","repos_url":"https://api.github.com/users/ekampp/repos","events_url":"https://api.github.com/users/ekampp/events{/privacy}","received_events_url":"https://api.github.com/users/ekampp/received_events","type":"User","site_admin":false},"body":"One (Decoder) for decoding and one (Encoder) for encoding.\r\n\r\nWe should consider moving all the classes into a namespace, to we don't have namespace collisions with any other, potential gems. ","created_at":"2014-10-19T08:52:21Z","updated_at":"2014-10-29T10:10:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab5c313011e28fa94b60b3562b05bfbaa5e8f7bc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kholbekj/bencoder/pulls/1/commits","review_comments_url":"https://api.github.com/repos/kholbekj/bencoder/pulls/1/comments","review_comment_url":"https://api.github.com/repos/kholbekj/bencoder/pulls/comments/{number}","comments_url":"https://api.github.com/repos/kholbekj/bencoder/issues/1/comments","statuses_url":"https://api.github.com/repos/kholbekj/bencoder/statuses/06961d67307b5e39fd0fc50d1192fcc6380137d7","head":{"label":"ekampp:patch-1","ref":"patch-1","sha":"06961d67307b5e39fd0fc50d1192fcc6380137d7","user":{"login":"ekampp","id":40206,"avatar_url":"https://avatars.githubusercontent.com/u/40206?v=2","gravatar_id":"","url":"https://api.github.com/users/ekampp","html_url":"https://github.com/ekampp","followers_url":"https://api.github.com/users/ekampp/followers","following_url":"https://api.github.com/users/ekampp/following{/other_user}","gists_url":"https://api.github.com/users/ekampp/gists{/gist_id}","starred_url":"https://api.github.com/users/ekampp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekampp/subscriptions","organizations_url":"https://api.github.com/users/ekampp/orgs","repos_url":"https://api.github.com/users/ekampp/repos","events_url":"https://api.github.com/users/ekampp/events{/privacy}","received_events_url":"https://api.github.com/users/ekampp/received_events","type":"User","site_admin":false},"repo":{"id":25421926,"name":"bencoder","full_name":"ekampp/bencoder","owner":{"login":"ekampp","id":40206,"avatar_url":"https://avatars.githubusercontent.com/u/40206?v=2","gravatar_id":"","url":"https://api.github.com/users/ekampp","html_url":"https://github.com/ekampp","followers_url":"https://api.github.com/users/ekampp/followers","following_url":"https://api.github.com/users/ekampp/following{/other_user}","gists_url":"https://api.github.com/users/ekampp/gists{/gist_id}","starred_url":"https://api.github.com/users/ekampp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekampp/subscriptions","organizations_url":"https://api.github.com/users/ekampp/orgs","repos_url":"https://api.github.com/users/ekampp/repos","events_url":"https://api.github.com/users/ekampp/events{/privacy}","received_events_url":"https://api.github.com/users/ekampp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ekampp/bencoder","description":"Bittorrent encoding in ruby","fork":true,"url":"https://api.github.com/repos/ekampp/bencoder","forks_url":"https://api.github.com/repos/ekampp/bencoder/forks","keys_url":"https://api.github.com/repos/ekampp/bencoder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ekampp/bencoder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ekampp/bencoder/teams","hooks_url":"https://api.github.com/repos/ekampp/bencoder/hooks","issue_events_url":"https://api.github.com/repos/ekampp/bencoder/issues/events{/number}","events_url":"https://api.github.com/repos/ekampp/bencoder/events","assignees_url":"https://api.github.com/repos/ekampp/bencoder/assignees{/user}","branches_url":"https://api.github.com/repos/ekampp/bencoder/branches{/branch}","tags_url":"https://api.github.com/repos/ekampp/bencoder/tags","blobs_url":"https://api.github.com/repos/ekampp/bencoder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ekampp/bencoder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ekampp/bencoder/git/refs{/sha}","trees_url":"https://api.github.com/repos/ekampp/bencoder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ekampp/bencoder/statuses/{sha}","languages_url":"https://api.github.com/repos/ekampp/bencoder/languages","stargazers_url":"https://api.github.com/repos/ekampp/bencoder/stargazers","contributors_url":"https://api.github.com/repos/ekampp/bencoder/contributors","subscribers_url":"https://api.github.com/repos/ekampp/bencoder/subscribers","subscription_url":"https://api.github.com/repos/ekampp/bencoder/subscription","commits_url":"https://api.github.com/repos/ekampp/bencoder/commits{/sha}","git_commits_url":"https://api.github.com/repos/ekampp/bencoder/git/commits{/sha}","comments_url":"https://api.github.com/repos/ekampp/bencoder/comments{/number}","issue_comment_url":"https://api.github.com/repos/ekampp/bencoder/issues/comments/{number}","contents_url":"https://api.github.com/repos/ekampp/bencoder/contents/{+path}","compare_url":"https://api.github.com/repos/ekampp/bencoder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ekampp/bencoder/merges","archive_url":"https://api.github.com/repos/ekampp/bencoder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ekampp/bencoder/downloads","issues_url":"https://api.github.com/repos/ekampp/bencoder/issues{/number}","pulls_url":"https://api.github.com/repos/ekampp/bencoder/pulls{/number}","milestones_url":"https://api.github.com/repos/ekampp/bencoder/milestones{/number}","notifications_url":"https://api.github.com/repos/ekampp/bencoder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ekampp/bencoder/labels{/name}","releases_url":"https://api.github.com/repos/ekampp/bencoder/releases{/id}","created_at":"2014-10-19T08:44:13Z","updated_at":"2014-10-13T16:49:15Z","pushed_at":"2014-10-19T08:52:18Z","git_url":"git://github.com/ekampp/bencoder.git","ssh_url":"git@github.com:ekampp/bencoder.git","clone_url":"https://github.com/ekampp/bencoder.git","svn_url":"https://github.com/ekampp/bencoder","homepage":null,"size":114,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kholbekj:master","ref":"master","sha":"37eefb53f8cb2d28dbe13fb9ed6e0eb9a0408a1b","user":{"login":"kholbekj","id":2786571,"avatar_url":"https://avatars.githubusercontent.com/u/2786571?v=2","gravatar_id":"","url":"https://api.github.com/users/kholbekj","html_url":"https://github.com/kholbekj","followers_url":"https://api.github.com/users/kholbekj/followers","following_url":"https://api.github.com/users/kholbekj/following{/other_user}","gists_url":"https://api.github.com/users/kholbekj/gists{/gist_id}","starred_url":"https://api.github.com/users/kholbekj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kholbekj/subscriptions","organizations_url":"https://api.github.com/users/kholbekj/orgs","repos_url":"https://api.github.com/users/kholbekj/repos","events_url":"https://api.github.com/users/kholbekj/events{/privacy}","received_events_url":"https://api.github.com/users/kholbekj/received_events","type":"User","site_admin":false},"repo":{"id":25167885,"name":"bencoder","full_name":"kholbekj/bencoder","owner":{"login":"kholbekj","id":2786571,"avatar_url":"https://avatars.githubusercontent.com/u/2786571?v=2","gravatar_id":"","url":"https://api.github.com/users/kholbekj","html_url":"https://github.com/kholbekj","followers_url":"https://api.github.com/users/kholbekj/followers","following_url":"https://api.github.com/users/kholbekj/following{/other_user}","gists_url":"https://api.github.com/users/kholbekj/gists{/gist_id}","starred_url":"https://api.github.com/users/kholbekj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kholbekj/subscriptions","organizations_url":"https://api.github.com/users/kholbekj/orgs","repos_url":"https://api.github.com/users/kholbekj/repos","events_url":"https://api.github.com/users/kholbekj/events{/privacy}","received_events_url":"https://api.github.com/users/kholbekj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kholbekj/bencoder","description":"Bittorrent encoding in ruby","fork":false,"url":"https://api.github.com/repos/kholbekj/bencoder","forks_url":"https://api.github.com/repos/kholbekj/bencoder/forks","keys_url":"https://api.github.com/repos/kholbekj/bencoder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kholbekj/bencoder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kholbekj/bencoder/teams","hooks_url":"https://api.github.com/repos/kholbekj/bencoder/hooks","issue_events_url":"https://api.github.com/repos/kholbekj/bencoder/issues/events{/number}","events_url":"https://api.github.com/repos/kholbekj/bencoder/events","assignees_url":"https://api.github.com/repos/kholbekj/bencoder/assignees{/user}","branches_url":"https://api.github.com/repos/kholbekj/bencoder/branches{/branch}","tags_url":"https://api.github.com/repos/kholbekj/bencoder/tags","blobs_url":"https://api.github.com/repos/kholbekj/bencoder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kholbekj/bencoder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kholbekj/bencoder/git/refs{/sha}","trees_url":"https://api.github.com/repos/kholbekj/bencoder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kholbekj/bencoder/statuses/{sha}","languages_url":"https://api.github.com/repos/kholbekj/bencoder/languages","stargazers_url":"https://api.github.com/repos/kholbekj/bencoder/stargazers","contributors_url":"https://api.github.com/repos/kholbekj/bencoder/contributors","subscribers_url":"https://api.github.com/repos/kholbekj/bencoder/subscribers","subscription_url":"https://api.github.com/repos/kholbekj/bencoder/subscription","commits_url":"https://api.github.com/repos/kholbekj/bencoder/commits{/sha}","git_commits_url":"https://api.github.com/repos/kholbekj/bencoder/git/commits{/sha}","comments_url":"https://api.github.com/repos/kholbekj/bencoder/comments{/number}","issue_comment_url":"https://api.github.com/repos/kholbekj/bencoder/issues/comments/{number}","contents_url":"https://api.github.com/repos/kholbekj/bencoder/contents/{+path}","compare_url":"https://api.github.com/repos/kholbekj/bencoder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kholbekj/bencoder/merges","archive_url":"https://api.github.com/repos/kholbekj/bencoder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kholbekj/bencoder/downloads","issues_url":"https://api.github.com/repos/kholbekj/bencoder/issues{/number}","pulls_url":"https://api.github.com/repos/kholbekj/bencoder/pulls{/number}","milestones_url":"https://api.github.com/repos/kholbekj/bencoder/milestones{/number}","notifications_url":"https://api.github.com/repos/kholbekj/bencoder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kholbekj/bencoder/labels{/name}","releases_url":"https://api.github.com/repos/kholbekj/bencoder/releases{/id}","created_at":"2014-10-13T16:48:12Z","updated_at":"2014-10-13T16:49:15Z","pushed_at":"2014-10-19T01:38:29Z","git_url":"git://github.com/kholbekj/bencoder.git","ssh_url":"git@github.com:kholbekj/bencoder.git","clone_url":"https://github.com/kholbekj/bencoder.git","svn_url":"https://github.com/kholbekj/bencoder","homepage":null,"size":238,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kholbekj/bencoder/pulls/1"},"html":{"href":"https://github.com/kholbekj/bencoder/pull/1"},"issue":{"href":"https://api.github.com/repos/kholbekj/bencoder/issues/1"},"comments":{"href":"https://api.github.com/repos/kholbekj/bencoder/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/kholbekj/bencoder/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/kholbekj/bencoder/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/kholbekj/bencoder/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/kholbekj/bencoder/statuses/06961d67307b5e39fd0fc50d1192fcc6380137d7"}}}}