{"action":"created","comment":{"url":"https://api.github.com/repos/meew0/discordrb/pulls/comments/112642733","pull_request_review_id":33971264,"id":112642733,"diff_hunk":"@@ -615,6 +615,33 @@ def remove_role(role)\n       end\n     end\n \n+    # @return [Role] the highest role this member has.\n+    def highest_role\n+      @roles.sort { |x,y| y <=> x }[0]\n+    end\n+\n+    # @return [Role] the role this member is being hoisted with.\n+    def hoist_role\n+      hoisted_roles = @roles.select(&:hoist)\n+      return nil if hoisted_roles.empty?\n+      hoisted_roles.sort { |x, y| y.position <=> x.position }[0]","path":"lib/discordrb/data.rb","position":13,"original_position":13,"commit_id":"8fe1632398ea3c303324ddb89fec301890eb6646","original_commit_id":"4545b81ce71020c77db207a2b870fafe2169951a","user":{"login":"z64","id":6119032,"avatar_url":"https://avatars3.githubusercontent.com/u/6119032?v=3","gravatar_id":"","url":"https://api.github.com/users/z64","html_url":"https://github.com/z64","followers_url":"https://api.github.com/users/z64/followers","following_url":"https://api.github.com/users/z64/following{/other_user}","gists_url":"https://api.github.com/users/z64/gists{/gist_id}","starred_url":"https://api.github.com/users/z64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/z64/subscriptions","organizations_url":"https://api.github.com/users/z64/orgs","repos_url":"https://api.github.com/users/z64/repos","events_url":"https://api.github.com/users/z64/events{/privacy}","received_events_url":"https://api.github.com/users/z64/received_events","type":"User","site_admin":false},"body":"If I recall, `#sort_by` would perform better here, but at the least would be more readable:\r\n\r\n`hoisted_roles.sort_by(&:position)[-1]` (or `#last`)\r\n\r\nJust a suggestion.","created_at":"2017-04-21T08:55:39Z","updated_at":"2017-04-21T08:56:50Z","html_url":"https://github.com/meew0/discordrb/pull/335#discussion_r112642733","pull_request_url":"https://api.github.com/repos/meew0/discordrb/pulls/335","_links":{"self":{"href":"https://api.github.com/repos/meew0/discordrb/pulls/comments/112642733"},"html":{"href":"https://github.com/meew0/discordrb/pull/335#discussion_r112642733"},"pull_request":{"href":"https://api.github.com/repos/meew0/discordrb/pulls/335"}}},"pull_request":{"url":"https://api.github.com/repos/meew0/discordrb/pulls/335","id":116937632,"html_url":"https://github.com/meew0/discordrb/pull/335","diff_url":"https://github.com/meew0/discordrb/pull/335.diff","patch_url":"https://github.com/meew0/discordrb/pull/335.patch","issue_url":"https://api.github.com/repos/meew0/discordrb/issues/335","number":335,"state":"open","locked":false,"title":"Roles and stuff","user":{"login":"SnazzyPine25","id":7025343,"avatar_url":"https://avatars2.githubusercontent.com/u/7025343?v=3","gravatar_id":"","url":"https://api.github.com/users/SnazzyPine25","html_url":"https://github.com/SnazzyPine25","followers_url":"https://api.github.com/users/SnazzyPine25/followers","following_url":"https://api.github.com/users/SnazzyPine25/following{/other_user}","gists_url":"https://api.github.com/users/SnazzyPine25/gists{/gist_id}","starred_url":"https://api.github.com/users/SnazzyPine25/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SnazzyPine25/subscriptions","organizations_url":"https://api.github.com/users/SnazzyPine25/orgs","repos_url":"https://api.github.com/users/SnazzyPine25/repos","events_url":"https://api.github.com/users/SnazzyPine25/events{/privacy}","received_events_url":"https://api.github.com/users/SnazzyPine25/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-21T08:43:23Z","updated_at":"2017-04-21T08:56:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a234357bcab2441d4fc7b623239d0e88d2cd3f49","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/meew0/discordrb/pulls/335/commits","review_comments_url":"https://api.github.com/repos/meew0/discordrb/pulls/335/comments","review_comment_url":"https://api.github.com/repos/meew0/discordrb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meew0/discordrb/issues/335/comments","statuses_url":"https://api.github.com/repos/meew0/discordrb/statuses/8fe1632398ea3c303324ddb89fec301890eb6646","head":{"label":"SnazzyPine25:patch-8","ref":"patch-8","sha":"8fe1632398ea3c303324ddb89fec301890eb6646","user":{"login":"SnazzyPine25","id":7025343,"avatar_url":"https://avatars2.githubusercontent.com/u/7025343?v=3","gravatar_id":"","url":"https://api.github.com/users/SnazzyPine25","html_url":"https://github.com/SnazzyPine25","followers_url":"https://api.github.com/users/SnazzyPine25/followers","following_url":"https://api.github.com/users/SnazzyPine25/following{/other_user}","gists_url":"https://api.github.com/users/SnazzyPine25/gists{/gist_id}","starred_url":"https://api.github.com/users/SnazzyPine25/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SnazzyPine25/subscriptions","organizations_url":"https://api.github.com/users/SnazzyPine25/orgs","repos_url":"https://api.github.com/users/SnazzyPine25/repos","events_url":"https://api.github.com/users/SnazzyPine25/events{/privacy}","received_events_url":"https://api.github.com/users/SnazzyPine25/received_events","type":"User","site_admin":false},"repo":{"id":58889306,"name":"discordrb","full_name":"SnazzyPine25/discordrb","owner":{"login":"SnazzyPine25","id":7025343,"avatar_url":"https://avatars2.githubusercontent.com/u/7025343?v=3","gravatar_id":"","url":"https://api.github.com/users/SnazzyPine25","html_url":"https://github.com/SnazzyPine25","followers_url":"https://api.github.com/users/SnazzyPine25/followers","following_url":"https://api.github.com/users/SnazzyPine25/following{/other_user}","gists_url":"https://api.github.com/users/SnazzyPine25/gists{/gist_id}","starred_url":"https://api.github.com/users/SnazzyPine25/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SnazzyPine25/subscriptions","organizations_url":"https://api.github.com/users/SnazzyPine25/orgs","repos_url":"https://api.github.com/users/SnazzyPine25/repos","events_url":"https://api.github.com/users/SnazzyPine25/events{/privacy}","received_events_url":"https://api.github.com/users/SnazzyPine25/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SnazzyPine25/discordrb","description":"Discord API for Ruby","fork":true,"url":"https://api.github.com/repos/SnazzyPine25/discordrb","forks_url":"https://api.github.com/repos/SnazzyPine25/discordrb/forks","keys_url":"https://api.github.com/repos/SnazzyPine25/discordrb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SnazzyPine25/discordrb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SnazzyPine25/discordrb/teams","hooks_url":"https://api.github.com/repos/SnazzyPine25/discordrb/hooks","issue_events_url":"https://api.github.com/repos/SnazzyPine25/discordrb/issues/events{/number}","events_url":"https://api.github.com/repos/SnazzyPine25/discordrb/events","assignees_url":"https://api.github.com/repos/SnazzyPine25/discordrb/assignees{/user}","branches_url":"https://api.github.com/repos/SnazzyPine25/discordrb/branches{/branch}","tags_url":"https://api.github.com/repos/SnazzyPine25/discordrb/tags","blobs_url":"https://api.github.com/repos/SnazzyPine25/discordrb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SnazzyPine25/discordrb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SnazzyPine25/discordrb/git/refs{/sha}","trees_url":"https://api.github.com/repos/SnazzyPine25/discordrb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SnazzyPine25/discordrb/statuses/{sha}","languages_url":"https://api.github.com/repos/SnazzyPine25/discordrb/languages","stargazers_url":"https://api.github.com/repos/SnazzyPine25/discordrb/stargazers","contributors_url":"https://api.github.com/repos/SnazzyPine25/discordrb/contributors","subscribers_url":"https://api.github.com/repos/SnazzyPine25/discordrb/subscribers","subscription_url":"https://api.github.com/repos/SnazzyPine25/discordrb/subscription","commits_url":"https://api.github.com/repos/SnazzyPine25/discordrb/commits{/sha}","git_commits_url":"https://api.github.com/repos/SnazzyPine25/discordrb/git/commits{/sha}","comments_url":"https://api.github.com/repos/SnazzyPine25/discordrb/comments{/number}","issue_comment_url":"https://api.github.com/repos/SnazzyPine25/discordrb/issues/comments{/number}","contents_url":"https://api.github.com/repos/SnazzyPine25/discordrb/contents/{+path}","compare_url":"https://api.github.com/repos/SnazzyPine25/discordrb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SnazzyPine25/discordrb/merges","archive_url":"https://api.github.com/repos/SnazzyPine25/discordrb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SnazzyPine25/discordrb/downloads","issues_url":"https://api.github.com/repos/SnazzyPine25/discordrb/issues{/number}","pulls_url":"https://api.github.com/repos/SnazzyPine25/discordrb/pulls{/number}","milestones_url":"https://api.github.com/repos/SnazzyPine25/discordrb/milestones{/number}","notifications_url":"https://api.github.com/repos/SnazzyPine25/discordrb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SnazzyPine25/discordrb/labels{/name}","releases_url":"https://api.github.com/repos/SnazzyPine25/discordrb/releases{/id}","deployments_url":"https://api.github.com/repos/SnazzyPine25/discordrb/deployments","created_at":"2016-05-15T23:11:09Z","updated_at":"2016-05-15T23:11:10Z","pushed_at":"2017-04-21T08:54:23Z","git_url":"git://github.com/SnazzyPine25/discordrb.git","ssh_url":"git@github.com:SnazzyPine25/discordrb.git","clone_url":"https://github.com/SnazzyPine25/discordrb.git","svn_url":"https://github.com/SnazzyPine25/discordrb","homepage":"https://discord.gg/0SBTUU1wZTWfFQL2","size":2939,"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,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"meew0:master","ref":"master","sha":"78a2e61a7d5400a4a182f12e63f24cdb815d4bf5","user":{"login":"meew0","id":3662915,"avatar_url":"https://avatars3.githubusercontent.com/u/3662915?v=3","gravatar_id":"","url":"https://api.github.com/users/meew0","html_url":"https://github.com/meew0","followers_url":"https://api.github.com/users/meew0/followers","following_url":"https://api.github.com/users/meew0/following{/other_user}","gists_url":"https://api.github.com/users/meew0/gists{/gist_id}","starred_url":"https://api.github.com/users/meew0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meew0/subscriptions","organizations_url":"https://api.github.com/users/meew0/orgs","repos_url":"https://api.github.com/users/meew0/repos","events_url":"https://api.github.com/users/meew0/events{/privacy}","received_events_url":"https://api.github.com/users/meew0/received_events","type":"User","site_admin":false},"repo":{"id":40984778,"name":"discordrb","full_name":"meew0/discordrb","owner":{"login":"meew0","id":3662915,"avatar_url":"https://avatars3.githubusercontent.com/u/3662915?v=3","gravatar_id":"","url":"https://api.github.com/users/meew0","html_url":"https://github.com/meew0","followers_url":"https://api.github.com/users/meew0/followers","following_url":"https://api.github.com/users/meew0/following{/other_user}","gists_url":"https://api.github.com/users/meew0/gists{/gist_id}","starred_url":"https://api.github.com/users/meew0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meew0/subscriptions","organizations_url":"https://api.github.com/users/meew0/orgs","repos_url":"https://api.github.com/users/meew0/repos","events_url":"https://api.github.com/users/meew0/events{/privacy}","received_events_url":"https://api.github.com/users/meew0/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/meew0/discordrb","description":"Discord API for Ruby","fork":false,"url":"https://api.github.com/repos/meew0/discordrb","forks_url":"https://api.github.com/repos/meew0/discordrb/forks","keys_url":"https://api.github.com/repos/meew0/discordrb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meew0/discordrb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meew0/discordrb/teams","hooks_url":"https://api.github.com/repos/meew0/discordrb/hooks","issue_events_url":"https://api.github.com/repos/meew0/discordrb/issues/events{/number}","events_url":"https://api.github.com/repos/meew0/discordrb/events","assignees_url":"https://api.github.com/repos/meew0/discordrb/assignees{/user}","branches_url":"https://api.github.com/repos/meew0/discordrb/branches{/branch}","tags_url":"https://api.github.com/repos/meew0/discordrb/tags","blobs_url":"https://api.github.com/repos/meew0/discordrb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meew0/discordrb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meew0/discordrb/git/refs{/sha}","trees_url":"https://api.github.com/repos/meew0/discordrb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meew0/discordrb/statuses/{sha}","languages_url":"https://api.github.com/repos/meew0/discordrb/languages","stargazers_url":"https://api.github.com/repos/meew0/discordrb/stargazers","contributors_url":"https://api.github.com/repos/meew0/discordrb/contributors","subscribers_url":"https://api.github.com/repos/meew0/discordrb/subscribers","subscription_url":"https://api.github.com/repos/meew0/discordrb/subscription","commits_url":"https://api.github.com/repos/meew0/discordrb/commits{/sha}","git_commits_url":"https://api.github.com/repos/meew0/discordrb/git/commits{/sha}","comments_url":"https://api.github.com/repos/meew0/discordrb/comments{/number}","issue_comment_url":"https://api.github.com/repos/meew0/discordrb/issues/comments{/number}","contents_url":"https://api.github.com/repos/meew0/discordrb/contents/{+path}","compare_url":"https://api.github.com/repos/meew0/discordrb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meew0/discordrb/merges","archive_url":"https://api.github.com/repos/meew0/discordrb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meew0/discordrb/downloads","issues_url":"https://api.github.com/repos/meew0/discordrb/issues{/number}","pulls_url":"https://api.github.com/repos/meew0/discordrb/pulls{/number}","milestones_url":"https://api.github.com/repos/meew0/discordrb/milestones{/number}","notifications_url":"https://api.github.com/repos/meew0/discordrb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meew0/discordrb/labels{/name}","releases_url":"https://api.github.com/repos/meew0/discordrb/releases{/id}","deployments_url":"https://api.github.com/repos/meew0/discordrb/deployments","created_at":"2015-08-18T16:51:30Z","updated_at":"2017-04-16T16:20:54Z","pushed_at":"2017-04-21T08:54:24Z","git_url":"git://github.com/meew0/discordrb.git","ssh_url":"git@github.com:meew0/discordrb.git","clone_url":"https://github.com/meew0/discordrb.git","svn_url":"https://github.com/meew0/discordrb","homepage":"https://discord.gg/0SBTUU1wZTWfFQL2","size":2951,"stargazers_count":192,"watchers_count":192,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":72,"mirror_url":null,"open_issues_count":15,"forks":72,"open_issues":15,"watchers":192,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meew0/discordrb/pulls/335"},"html":{"href":"https://github.com/meew0/discordrb/pull/335"},"issue":{"href":"https://api.github.com/repos/meew0/discordrb/issues/335"},"comments":{"href":"https://api.github.com/repos/meew0/discordrb/issues/335/comments"},"review_comments":{"href":"https://api.github.com/repos/meew0/discordrb/pulls/335/comments"},"review_comment":{"href":"https://api.github.com/repos/meew0/discordrb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meew0/discordrb/pulls/335/commits"},"statuses":{"href":"https://api.github.com/repos/meew0/discordrb/statuses/8fe1632398ea3c303324ddb89fec301890eb6646"}}}}
{"actor":{"display_login":"z64"}}