{"action":"created","comment":{"url":"https://api.github.com/repos/SciRuby/daru/pulls/comments/166727105","pull_request_review_id":94836927,"id":166727105,"diff_hunk":"@@ -918,10 +918,27 @@ def modify_category_at pos, category\n       end\n       old_category = category_from_position pos\n       @array[pos] = int_from_cat category\n-      @cat_hash[old_category].delete pos\n+      @cat_hash[old_category].delete pos unless old_category.nil?\n       @cat_hash[category] << pos\n     end\n \n+    def set pos, category\n+      unless categories.include? category\n+        raise ArgumentError, \"Invalid category #{category}, \"\\\n+          'to add a new category use #add_category'\n+      end\n+      pos = pos.is_a?(Array) ? pos : [pos]\n+      pos.each do |x|\n+        if @index.include? x\n+          self.[]= x, category\n+          next\n+        end\n+        @array << categories.index(category)\n+        @index = @index.add(x)","path":"lib/daru/category.rb","position":21,"original_position":21,"commit_id":"c6421f17f0bc9116aeedb2d977cafea782c71346","original_commit_id":"c6421f17f0bc9116aeedb2d977cafea782c71346","user":{"login":"lokeshh","id":7677524,"avatar_url":"https://avatars3.githubusercontent.com/u/7677524?v=4","gravatar_id":"","url":"https://api.github.com/users/lokeshh","html_url":"https://github.com/lokeshh","followers_url":"https://api.github.com/users/lokeshh/followers","following_url":"https://api.github.com/users/lokeshh/following{/other_user}","gists_url":"https://api.github.com/users/lokeshh/gists{/gist_id}","starred_url":"https://api.github.com/users/lokeshh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokeshh/subscriptions","organizations_url":"https://api.github.com/users/lokeshh/orgs","repos_url":"https://api.github.com/users/lokeshh/repos","events_url":"https://api.github.com/users/lokeshh/events{/privacy}","received_events_url":"https://api.github.com/users/lokeshh/received_events","type":"User","site_admin":false},"body":"I think it will be better to use cat_to_int function here","created_at":"2018-02-07T19:22:45Z","updated_at":"2018-02-07T19:23:13Z","html_url":"https://github.com/SciRuby/daru/pull/446#discussion_r166727105","pull_request_url":"https://api.github.com/repos/SciRuby/daru/pulls/446","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/SciRuby/daru/pulls/comments/166727105"},"html":{"href":"https://github.com/SciRuby/daru/pull/446#discussion_r166727105"},"pull_request":{"href":"https://api.github.com/repos/SciRuby/daru/pulls/446"}}},"pull_request":{"url":"https://api.github.com/repos/SciRuby/daru/pulls/446","id":161866558,"html_url":"https://github.com/SciRuby/daru/pull/446","diff_url":"https://github.com/SciRuby/daru/pull/446.diff","patch_url":"https://github.com/SciRuby/daru/pull/446.patch","issue_url":"https://api.github.com/repos/SciRuby/daru/issues/446","number":446,"state":"open","locked":false,"title":"add method set to category.rb","user":{"login":"rohitner","id":21151546,"avatar_url":"https://avatars1.githubusercontent.com/u/21151546?v=4","gravatar_id":"","url":"https://api.github.com/users/rohitner","html_url":"https://github.com/rohitner","followers_url":"https://api.github.com/users/rohitner/followers","following_url":"https://api.github.com/users/rohitner/following{/other_user}","gists_url":"https://api.github.com/users/rohitner/gists{/gist_id}","starred_url":"https://api.github.com/users/rohitner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohitner/subscriptions","organizations_url":"https://api.github.com/users/rohitner/orgs","repos_url":"https://api.github.com/users/rohitner/repos","events_url":"https://api.github.com/users/rohitner/events{/privacy}","received_events_url":"https://api.github.com/users/rohitner/received_events","type":"User","site_admin":false},"body":"created a PR for discussion on issue #390 \r\n  ","created_at":"2018-01-09T13:06:00Z","updated_at":"2018-02-07T19:23:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7396edb12850132710759a9ffc7ac9594352afc0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/SciRuby/daru/pulls/446/commits","review_comments_url":"https://api.github.com/repos/SciRuby/daru/pulls/446/comments","review_comment_url":"https://api.github.com/repos/SciRuby/daru/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SciRuby/daru/issues/446/comments","statuses_url":"https://api.github.com/repos/SciRuby/daru/statuses/c6421f17f0bc9116aeedb2d977cafea782c71346","head":{"label":"rohitner:category-vector-set","ref":"category-vector-set","sha":"c6421f17f0bc9116aeedb2d977cafea782c71346","user":{"login":"rohitner","id":21151546,"avatar_url":"https://avatars1.githubusercontent.com/u/21151546?v=4","gravatar_id":"","url":"https://api.github.com/users/rohitner","html_url":"https://github.com/rohitner","followers_url":"https://api.github.com/users/rohitner/followers","following_url":"https://api.github.com/users/rohitner/following{/other_user}","gists_url":"https://api.github.com/users/rohitner/gists{/gist_id}","starred_url":"https://api.github.com/users/rohitner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohitner/subscriptions","organizations_url":"https://api.github.com/users/rohitner/orgs","repos_url":"https://api.github.com/users/rohitner/repos","events_url":"https://api.github.com/users/rohitner/events{/privacy}","received_events_url":"https://api.github.com/users/rohitner/received_events","type":"User","site_admin":false},"repo":{"id":113600159,"name":"daru","full_name":"rohitner/daru","owner":{"login":"rohitner","id":21151546,"avatar_url":"https://avatars1.githubusercontent.com/u/21151546?v=4","gravatar_id":"","url":"https://api.github.com/users/rohitner","html_url":"https://github.com/rohitner","followers_url":"https://api.github.com/users/rohitner/followers","following_url":"https://api.github.com/users/rohitner/following{/other_user}","gists_url":"https://api.github.com/users/rohitner/gists{/gist_id}","starred_url":"https://api.github.com/users/rohitner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohitner/subscriptions","organizations_url":"https://api.github.com/users/rohitner/orgs","repos_url":"https://api.github.com/users/rohitner/repos","events_url":"https://api.github.com/users/rohitner/events{/privacy}","received_events_url":"https://api.github.com/users/rohitner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rohitner/daru","description":"Data Analysis in RUby","fork":true,"url":"https://api.github.com/repos/rohitner/daru","forks_url":"https://api.github.com/repos/rohitner/daru/forks","keys_url":"https://api.github.com/repos/rohitner/daru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rohitner/daru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rohitner/daru/teams","hooks_url":"https://api.github.com/repos/rohitner/daru/hooks","issue_events_url":"https://api.github.com/repos/rohitner/daru/issues/events{/number}","events_url":"https://api.github.com/repos/rohitner/daru/events","assignees_url":"https://api.github.com/repos/rohitner/daru/assignees{/user}","branches_url":"https://api.github.com/repos/rohitner/daru/branches{/branch}","tags_url":"https://api.github.com/repos/rohitner/daru/tags","blobs_url":"https://api.github.com/repos/rohitner/daru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rohitner/daru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rohitner/daru/git/refs{/sha}","trees_url":"https://api.github.com/repos/rohitner/daru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rohitner/daru/statuses/{sha}","languages_url":"https://api.github.com/repos/rohitner/daru/languages","stargazers_url":"https://api.github.com/repos/rohitner/daru/stargazers","contributors_url":"https://api.github.com/repos/rohitner/daru/contributors","subscribers_url":"https://api.github.com/repos/rohitner/daru/subscribers","subscription_url":"https://api.github.com/repos/rohitner/daru/subscription","commits_url":"https://api.github.com/repos/rohitner/daru/commits{/sha}","git_commits_url":"https://api.github.com/repos/rohitner/daru/git/commits{/sha}","comments_url":"https://api.github.com/repos/rohitner/daru/comments{/number}","issue_comment_url":"https://api.github.com/repos/rohitner/daru/issues/comments{/number}","contents_url":"https://api.github.com/repos/rohitner/daru/contents/{+path}","compare_url":"https://api.github.com/repos/rohitner/daru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rohitner/daru/merges","archive_url":"https://api.github.com/repos/rohitner/daru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rohitner/daru/downloads","issues_url":"https://api.github.com/repos/rohitner/daru/issues{/number}","pulls_url":"https://api.github.com/repos/rohitner/daru/pulls{/number}","milestones_url":"https://api.github.com/repos/rohitner/daru/milestones{/number}","notifications_url":"https://api.github.com/repos/rohitner/daru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rohitner/daru/labels{/name}","releases_url":"https://api.github.com/repos/rohitner/daru/releases{/id}","deployments_url":"https://api.github.com/repos/rohitner/daru/deployments","created_at":"2017-12-08T17:28:32Z","updated_at":"2017-12-08T17:28:34Z","pushed_at":"2018-02-07T11:07:00Z","git_url":"git://github.com/rohitner/daru.git","ssh_url":"git@github.com:rohitner/daru.git","clone_url":"https://github.com/rohitner/daru.git","svn_url":"https://github.com/rohitner/daru","homepage":null,"size":4481,"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":"SciRuby:master","ref":"master","sha":"2f312d130ca8f5db321a309bd595acc07b047efe","user":{"login":"SciRuby","id":550805,"avatar_url":"https://avatars3.githubusercontent.com/u/550805?v=4","gravatar_id":"","url":"https://api.github.com/users/SciRuby","html_url":"https://github.com/SciRuby","followers_url":"https://api.github.com/users/SciRuby/followers","following_url":"https://api.github.com/users/SciRuby/following{/other_user}","gists_url":"https://api.github.com/users/SciRuby/gists{/gist_id}","starred_url":"https://api.github.com/users/SciRuby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciRuby/subscriptions","organizations_url":"https://api.github.com/users/SciRuby/orgs","repos_url":"https://api.github.com/users/SciRuby/repos","events_url":"https://api.github.com/users/SciRuby/events{/privacy}","received_events_url":"https://api.github.com/users/SciRuby/received_events","type":"Organization","site_admin":false},"repo":{"id":24784998,"name":"daru","full_name":"SciRuby/daru","owner":{"login":"SciRuby","id":550805,"avatar_url":"https://avatars3.githubusercontent.com/u/550805?v=4","gravatar_id":"","url":"https://api.github.com/users/SciRuby","html_url":"https://github.com/SciRuby","followers_url":"https://api.github.com/users/SciRuby/followers","following_url":"https://api.github.com/users/SciRuby/following{/other_user}","gists_url":"https://api.github.com/users/SciRuby/gists{/gist_id}","starred_url":"https://api.github.com/users/SciRuby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciRuby/subscriptions","organizations_url":"https://api.github.com/users/SciRuby/orgs","repos_url":"https://api.github.com/users/SciRuby/repos","events_url":"https://api.github.com/users/SciRuby/events{/privacy}","received_events_url":"https://api.github.com/users/SciRuby/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SciRuby/daru","description":"Data Analysis in RUby","fork":false,"url":"https://api.github.com/repos/SciRuby/daru","forks_url":"https://api.github.com/repos/SciRuby/daru/forks","keys_url":"https://api.github.com/repos/SciRuby/daru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SciRuby/daru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SciRuby/daru/teams","hooks_url":"https://api.github.com/repos/SciRuby/daru/hooks","issue_events_url":"https://api.github.com/repos/SciRuby/daru/issues/events{/number}","events_url":"https://api.github.com/repos/SciRuby/daru/events","assignees_url":"https://api.github.com/repos/SciRuby/daru/assignees{/user}","branches_url":"https://api.github.com/repos/SciRuby/daru/branches{/branch}","tags_url":"https://api.github.com/repos/SciRuby/daru/tags","blobs_url":"https://api.github.com/repos/SciRuby/daru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SciRuby/daru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SciRuby/daru/git/refs{/sha}","trees_url":"https://api.github.com/repos/SciRuby/daru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SciRuby/daru/statuses/{sha}","languages_url":"https://api.github.com/repos/SciRuby/daru/languages","stargazers_url":"https://api.github.com/repos/SciRuby/daru/stargazers","contributors_url":"https://api.github.com/repos/SciRuby/daru/contributors","subscribers_url":"https://api.github.com/repos/SciRuby/daru/subscribers","subscription_url":"https://api.github.com/repos/SciRuby/daru/subscription","commits_url":"https://api.github.com/repos/SciRuby/daru/commits{/sha}","git_commits_url":"https://api.github.com/repos/SciRuby/daru/git/commits{/sha}","comments_url":"https://api.github.com/repos/SciRuby/daru/comments{/number}","issue_comment_url":"https://api.github.com/repos/SciRuby/daru/issues/comments{/number}","contents_url":"https://api.github.com/repos/SciRuby/daru/contents/{+path}","compare_url":"https://api.github.com/repos/SciRuby/daru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SciRuby/daru/merges","archive_url":"https://api.github.com/repos/SciRuby/daru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SciRuby/daru/downloads","issues_url":"https://api.github.com/repos/SciRuby/daru/issues{/number}","pulls_url":"https://api.github.com/repos/SciRuby/daru/pulls{/number}","milestones_url":"https://api.github.com/repos/SciRuby/daru/milestones{/number}","notifications_url":"https://api.github.com/repos/SciRuby/daru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SciRuby/daru/labels{/name}","releases_url":"https://api.github.com/repos/SciRuby/daru/releases{/id}","deployments_url":"https://api.github.com/repos/SciRuby/daru/deployments","created_at":"2014-10-04T08:23:21Z","updated_at":"2018-02-04T15:14:29Z","pushed_at":"2018-02-07T11:07:01Z","git_url":"git://github.com/SciRuby/daru.git","ssh_url":"git@github.com:SciRuby/daru.git","clone_url":"https://github.com/SciRuby/daru.git","svn_url":"https://github.com/SciRuby/daru","homepage":null,"size":4464,"stargazers_count":582,"watchers_count":582,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"archived":false,"open_issues_count":61,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause"},"forks":83,"open_issues":61,"watchers":582,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SciRuby/daru/pulls/446"},"html":{"href":"https://github.com/SciRuby/daru/pull/446"},"issue":{"href":"https://api.github.com/repos/SciRuby/daru/issues/446"},"comments":{"href":"https://api.github.com/repos/SciRuby/daru/issues/446/comments"},"review_comments":{"href":"https://api.github.com/repos/SciRuby/daru/pulls/446/comments"},"review_comment":{"href":"https://api.github.com/repos/SciRuby/daru/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SciRuby/daru/pulls/446/commits"},"statuses":{"href":"https://api.github.com/repos/SciRuby/daru/statuses/c6421f17f0bc9116aeedb2d977cafea782c71346"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lokeshh"}}