{"action":"opened","number":15,"pull_request":{"url":"https://api.github.com/repos/onthebeach/guidelines/pulls/15","id":50405148,"html_url":"https://github.com/onthebeach/guidelines/pull/15","diff_url":"https://github.com/onthebeach/guidelines/pull/15.diff","patch_url":"https://github.com/onthebeach/guidelines/pull/15.patch","issue_url":"https://api.github.com/repos/onthebeach/guidelines/issues/15","number":15,"state":"open","locked":false,"title":"Replace the protected with private for accessors","user":{"login":"hatoishi","id":399960,"avatar_url":"https://avatars.githubusercontent.com/u/399960?v=3","gravatar_id":"","url":"https://api.github.com/users/hatoishi","html_url":"https://github.com/hatoishi","followers_url":"https://api.github.com/users/hatoishi/followers","following_url":"https://api.github.com/users/hatoishi/following{/other_user}","gists_url":"https://api.github.com/users/hatoishi/gists{/gist_id}","starred_url":"https://api.github.com/users/hatoishi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hatoishi/subscriptions","organizations_url":"https://api.github.com/users/hatoishi/orgs","repos_url":"https://api.github.com/users/hatoishi/repos","events_url":"https://api.github.com/users/hatoishi/events{/privacy}","received_events_url":"https://api.github.com/users/hatoishi/received_events","type":"User","site_admin":false},"body":"The style guide currently uses protected to control visibility of\r\naccessors. In the example I believe the example is intended to\r\nbe a private accessor not a protected one. The use of protected is a\r\nhack and is used to prevent a warning the ruby interpreter issues when\r\nit encounters a private accessor.\r\n\r\nThe core ruby team think accessors should only be used for public\r\ninterfaces, but many other rubyists think it is good practice to use\r\naccessors even for private instance variables. OTB is in the latter\r\ncamp.\r\n\r\nThe vast majority of our code does not require protected accessors. To\r\nmy knowledge a protected accessor is only needed to implement comparable\r\nobjects. Using the hack is tolerable to reduce the warning noise we\r\nmight see from code checkers in the future.\r\n\r\nHowever, there is no warning when the accessor is declared as private\r\nafterwards as in:\r\n\r\n```\r\nclass User\r\n  attr_reader :email\r\n  private :email\r\nend\r\n```\r\n\r\nThis causes no warnings from MRI (ree -> 2.2). The warning trying to be\r\navoided occurs only if the accessor is defined below a private keyword\r\nas in:\r\n\r\n```\r\nclass User\r\n  private\r\n  attr_reader :email\r\nend\r\n```\r\n\r\n```\r\ntest.rb:3: warning: private attribute?\r\n```\r\n\r\nBut since our guide has the accessor defined in the former style anyway, I\r\nsuggest we don't need to use the protected hack any more.","created_at":"2015-11-11T16:40:40Z","updated_at":"2015-11-11T16:40:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/onthebeach/guidelines/pulls/15/commits","review_comments_url":"https://api.github.com/repos/onthebeach/guidelines/pulls/15/comments","review_comment_url":"https://api.github.com/repos/onthebeach/guidelines/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onthebeach/guidelines/issues/15/comments","statuses_url":"https://api.github.com/repos/onthebeach/guidelines/statuses/d2ce17af13b2d6fa8a8e1190bf8fa30ba78cab52","head":{"label":"onthebeach:feature/private-accessors","ref":"feature/private-accessors","sha":"d2ce17af13b2d6fa8a8e1190bf8fa30ba78cab52","user":{"login":"onthebeach","id":448417,"avatar_url":"https://avatars.githubusercontent.com/u/448417?v=3","gravatar_id":"","url":"https://api.github.com/users/onthebeach","html_url":"https://github.com/onthebeach","followers_url":"https://api.github.com/users/onthebeach/followers","following_url":"https://api.github.com/users/onthebeach/following{/other_user}","gists_url":"https://api.github.com/users/onthebeach/gists{/gist_id}","starred_url":"https://api.github.com/users/onthebeach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onthebeach/subscriptions","organizations_url":"https://api.github.com/users/onthebeach/orgs","repos_url":"https://api.github.com/users/onthebeach/repos","events_url":"https://api.github.com/users/onthebeach/events{/privacy}","received_events_url":"https://api.github.com/users/onthebeach/received_events","type":"Organization","site_admin":false},"repo":{"id":18219165,"name":"guidelines","full_name":"onthebeach/guidelines","owner":{"login":"onthebeach","id":448417,"avatar_url":"https://avatars.githubusercontent.com/u/448417?v=3","gravatar_id":"","url":"https://api.github.com/users/onthebeach","html_url":"https://github.com/onthebeach","followers_url":"https://api.github.com/users/onthebeach/followers","following_url":"https://api.github.com/users/onthebeach/following{/other_user}","gists_url":"https://api.github.com/users/onthebeach/gists{/gist_id}","starred_url":"https://api.github.com/users/onthebeach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onthebeach/subscriptions","organizations_url":"https://api.github.com/users/onthebeach/orgs","repos_url":"https://api.github.com/users/onthebeach/repos","events_url":"https://api.github.com/users/onthebeach/events{/privacy}","received_events_url":"https://api.github.com/users/onthebeach/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onthebeach/guidelines","description":"These guidelines provide a summary of our coding style","fork":false,"url":"https://api.github.com/repos/onthebeach/guidelines","forks_url":"https://api.github.com/repos/onthebeach/guidelines/forks","keys_url":"https://api.github.com/repos/onthebeach/guidelines/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onthebeach/guidelines/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onthebeach/guidelines/teams","hooks_url":"https://api.github.com/repos/onthebeach/guidelines/hooks","issue_events_url":"https://api.github.com/repos/onthebeach/guidelines/issues/events{/number}","events_url":"https://api.github.com/repos/onthebeach/guidelines/events","assignees_url":"https://api.github.com/repos/onthebeach/guidelines/assignees{/user}","branches_url":"https://api.github.com/repos/onthebeach/guidelines/branches{/branch}","tags_url":"https://api.github.com/repos/onthebeach/guidelines/tags","blobs_url":"https://api.github.com/repos/onthebeach/guidelines/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onthebeach/guidelines/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onthebeach/guidelines/git/refs{/sha}","trees_url":"https://api.github.com/repos/onthebeach/guidelines/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onthebeach/guidelines/statuses/{sha}","languages_url":"https://api.github.com/repos/onthebeach/guidelines/languages","stargazers_url":"https://api.github.com/repos/onthebeach/guidelines/stargazers","contributors_url":"https://api.github.com/repos/onthebeach/guidelines/contributors","subscribers_url":"https://api.github.com/repos/onthebeach/guidelines/subscribers","subscription_url":"https://api.github.com/repos/onthebeach/guidelines/subscription","commits_url":"https://api.github.com/repos/onthebeach/guidelines/commits{/sha}","git_commits_url":"https://api.github.com/repos/onthebeach/guidelines/git/commits{/sha}","comments_url":"https://api.github.com/repos/onthebeach/guidelines/comments{/number}","issue_comment_url":"https://api.github.com/repos/onthebeach/guidelines/issues/comments{/number}","contents_url":"https://api.github.com/repos/onthebeach/guidelines/contents/{+path}","compare_url":"https://api.github.com/repos/onthebeach/guidelines/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onthebeach/guidelines/merges","archive_url":"https://api.github.com/repos/onthebeach/guidelines/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onthebeach/guidelines/downloads","issues_url":"https://api.github.com/repos/onthebeach/guidelines/issues{/number}","pulls_url":"https://api.github.com/repos/onthebeach/guidelines/pulls{/number}","milestones_url":"https://api.github.com/repos/onthebeach/guidelines/milestones{/number}","notifications_url":"https://api.github.com/repos/onthebeach/guidelines/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onthebeach/guidelines/labels{/name}","releases_url":"https://api.github.com/repos/onthebeach/guidelines/releases{/id}","created_at":"2014-03-28T16:41:27Z","updated_at":"2015-07-26T20:37:42Z","pushed_at":"2015-11-11T16:40:40Z","git_url":"git://github.com/onthebeach/guidelines.git","ssh_url":"git@github.com:onthebeach/guidelines.git","clone_url":"https://github.com/onthebeach/guidelines.git","svn_url":"https://github.com/onthebeach/guidelines","homepage":null,"size":305,"stargazers_count":6,"watchers_count":6,"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":6,"default_branch":"master"}},"base":{"label":"onthebeach:master","ref":"master","sha":"b6ef0fda02e25a8f1d55cf817ecd671e83cef1b9","user":{"login":"onthebeach","id":448417,"avatar_url":"https://avatars.githubusercontent.com/u/448417?v=3","gravatar_id":"","url":"https://api.github.com/users/onthebeach","html_url":"https://github.com/onthebeach","followers_url":"https://api.github.com/users/onthebeach/followers","following_url":"https://api.github.com/users/onthebeach/following{/other_user}","gists_url":"https://api.github.com/users/onthebeach/gists{/gist_id}","starred_url":"https://api.github.com/users/onthebeach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onthebeach/subscriptions","organizations_url":"https://api.github.com/users/onthebeach/orgs","repos_url":"https://api.github.com/users/onthebeach/repos","events_url":"https://api.github.com/users/onthebeach/events{/privacy}","received_events_url":"https://api.github.com/users/onthebeach/received_events","type":"Organization","site_admin":false},"repo":{"id":18219165,"name":"guidelines","full_name":"onthebeach/guidelines","owner":{"login":"onthebeach","id":448417,"avatar_url":"https://avatars.githubusercontent.com/u/448417?v=3","gravatar_id":"","url":"https://api.github.com/users/onthebeach","html_url":"https://github.com/onthebeach","followers_url":"https://api.github.com/users/onthebeach/followers","following_url":"https://api.github.com/users/onthebeach/following{/other_user}","gists_url":"https://api.github.com/users/onthebeach/gists{/gist_id}","starred_url":"https://api.github.com/users/onthebeach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onthebeach/subscriptions","organizations_url":"https://api.github.com/users/onthebeach/orgs","repos_url":"https://api.github.com/users/onthebeach/repos","events_url":"https://api.github.com/users/onthebeach/events{/privacy}","received_events_url":"https://api.github.com/users/onthebeach/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onthebeach/guidelines","description":"These guidelines provide a summary of our coding style","fork":false,"url":"https://api.github.com/repos/onthebeach/guidelines","forks_url":"https://api.github.com/repos/onthebeach/guidelines/forks","keys_url":"https://api.github.com/repos/onthebeach/guidelines/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onthebeach/guidelines/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onthebeach/guidelines/teams","hooks_url":"https://api.github.com/repos/onthebeach/guidelines/hooks","issue_events_url":"https://api.github.com/repos/onthebeach/guidelines/issues/events{/number}","events_url":"https://api.github.com/repos/onthebeach/guidelines/events","assignees_url":"https://api.github.com/repos/onthebeach/guidelines/assignees{/user}","branches_url":"https://api.github.com/repos/onthebeach/guidelines/branches{/branch}","tags_url":"https://api.github.com/repos/onthebeach/guidelines/tags","blobs_url":"https://api.github.com/repos/onthebeach/guidelines/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onthebeach/guidelines/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onthebeach/guidelines/git/refs{/sha}","trees_url":"https://api.github.com/repos/onthebeach/guidelines/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onthebeach/guidelines/statuses/{sha}","languages_url":"https://api.github.com/repos/onthebeach/guidelines/languages","stargazers_url":"https://api.github.com/repos/onthebeach/guidelines/stargazers","contributors_url":"https://api.github.com/repos/onthebeach/guidelines/contributors","subscribers_url":"https://api.github.com/repos/onthebeach/guidelines/subscribers","subscription_url":"https://api.github.com/repos/onthebeach/guidelines/subscription","commits_url":"https://api.github.com/repos/onthebeach/guidelines/commits{/sha}","git_commits_url":"https://api.github.com/repos/onthebeach/guidelines/git/commits{/sha}","comments_url":"https://api.github.com/repos/onthebeach/guidelines/comments{/number}","issue_comment_url":"https://api.github.com/repos/onthebeach/guidelines/issues/comments{/number}","contents_url":"https://api.github.com/repos/onthebeach/guidelines/contents/{+path}","compare_url":"https://api.github.com/repos/onthebeach/guidelines/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onthebeach/guidelines/merges","archive_url":"https://api.github.com/repos/onthebeach/guidelines/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onthebeach/guidelines/downloads","issues_url":"https://api.github.com/repos/onthebeach/guidelines/issues{/number}","pulls_url":"https://api.github.com/repos/onthebeach/guidelines/pulls{/number}","milestones_url":"https://api.github.com/repos/onthebeach/guidelines/milestones{/number}","notifications_url":"https://api.github.com/repos/onthebeach/guidelines/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onthebeach/guidelines/labels{/name}","releases_url":"https://api.github.com/repos/onthebeach/guidelines/releases{/id}","created_at":"2014-03-28T16:41:27Z","updated_at":"2015-07-26T20:37:42Z","pushed_at":"2015-11-11T16:40:40Z","git_url":"git://github.com/onthebeach/guidelines.git","ssh_url":"git@github.com:onthebeach/guidelines.git","clone_url":"https://github.com/onthebeach/guidelines.git","svn_url":"https://github.com/onthebeach/guidelines","homepage":null,"size":305,"stargazers_count":6,"watchers_count":6,"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":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onthebeach/guidelines/pulls/15"},"html":{"href":"https://github.com/onthebeach/guidelines/pull/15"},"issue":{"href":"https://api.github.com/repos/onthebeach/guidelines/issues/15"},"comments":{"href":"https://api.github.com/repos/onthebeach/guidelines/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/onthebeach/guidelines/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/onthebeach/guidelines/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onthebeach/guidelines/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/onthebeach/guidelines/statuses/d2ce17af13b2d6fa8a8e1190bf8fa30ba78cab52"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":1,"deletions":1,"changed_files":1}}