{"action":"created","comment":{"url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/comments/70423482","id":70423482,"diff_hunk":"@@ -116,6 +116,12 @@ def legislative_periods\n     def directory\n       @directory = raw_data[:sources_directory].split('/')[1,2].join('/')\n     end\n+\n+    def self.from_sources_dir(dir)\n+      @index_by_sources ||= EveryPolitician::countries.map(&:legislatures).flatten.group_by(&:directory)\n+      # There must be a way to make this happen automatically in the line above","path":"lib/everypolitician.rb","position":7,"original_position":7,"commit_id":"21e35bb3a6c1ff97f5ee31d1cc9620a1e07e55e9","original_commit_id":"21e35bb3a6c1ff97f5ee31d1cc9620a1e07e55e9","user":{"login":"tmtmtmtm","id":57483,"avatar_url":"https://avatars.githubusercontent.com/u/57483?v=3","gravatar_id":"","url":"https://api.github.com/users/tmtmtmtm","html_url":"https://github.com/tmtmtmtm","followers_url":"https://api.github.com/users/tmtmtmtm/followers","following_url":"https://api.github.com/users/tmtmtmtm/following{/other_user}","gists_url":"https://api.github.com/users/tmtmtmtm/gists{/gist_id}","starred_url":"https://api.github.com/users/tmtmtmtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmtmtmtm/subscriptions","organizations_url":"https://api.github.com/users/tmtmtmtm/orgs","repos_url":"https://api.github.com/users/tmtmtmtm/repos","events_url":"https://api.github.com/users/tmtmtmtm/events{/privacy}","received_events_url":"https://api.github.com/users/tmtmtmtm/received_events","type":"User","site_admin":false},"body":"Well, you _could_ do\r\n\r\n```ruby\r\n(@index_by_sources ||= EveryPolitician::countries.map(&:legislatures).flatten.group_by(&:directory))[dir].first\r\n```\r\nbut I think that's a lot less clear.\r\n","created_at":"2016-07-12T11:52:21Z","updated_at":"2016-07-12T11:52:21Z","html_url":"https://github.com/everypolitician/everypolitician-ruby/pull/14#discussion_r70423482","pull_request_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/comments/70423482"},"html":{"href":"https://github.com/everypolitician/everypolitician-ruby/pull/14#discussion_r70423482"},"pull_request":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14","id":76978265,"html_url":"https://github.com/everypolitician/everypolitician-ruby/pull/14","diff_url":"https://github.com/everypolitician/everypolitician-ruby/pull/14.diff","patch_url":"https://github.com/everypolitician/everypolitician-ruby/pull/14.patch","issue_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/14","number":14,"state":"open","locked":false,"title":"Add a from_sources_dir method for dir to country/legislature","user":{"login":"struan","id":5310,"avatar_url":"https://avatars.githubusercontent.com/u/5310?v=3","gravatar_id":"","url":"https://api.github.com/users/struan","html_url":"https://github.com/struan","followers_url":"https://api.github.com/users/struan/followers","following_url":"https://api.github.com/users/struan/following{/other_user}","gists_url":"https://api.github.com/users/struan/gists{/gist_id}","starred_url":"https://api.github.com/users/struan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/struan/subscriptions","organizations_url":"https://api.github.com/users/struan/orgs","repos_url":"https://api.github.com/users/struan/repos","events_url":"https://api.github.com/users/struan/events{/privacy}","received_events_url":"https://api.github.com/users/struan/received_events","type":"User","site_admin":false},"body":"This is required for everypolitician#452 so we can work out from an\r\neverypolitician-data PR which countries and legislatures are affected.","created_at":"2016-07-11T15:55:32Z","updated_at":"2016-07-12T11:52:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1fe5ae22f26081bae823ea6b1d192ccacf31440","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14/commits","review_comments_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14/comments","review_comment_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/14/comments","statuses_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/statuses/21e35bb3a6c1ff97f5ee31d1cc9620a1e07e55e9","head":{"label":"everypolitician:from_sources_dir_map","ref":"from_sources_dir_map","sha":"21e35bb3a6c1ff97f5ee31d1cc9620a1e07e55e9","user":{"login":"everypolitician","id":12497298,"avatar_url":"https://avatars.githubusercontent.com/u/12497298?v=3","gravatar_id":"","url":"https://api.github.com/users/everypolitician","html_url":"https://github.com/everypolitician","followers_url":"https://api.github.com/users/everypolitician/followers","following_url":"https://api.github.com/users/everypolitician/following{/other_user}","gists_url":"https://api.github.com/users/everypolitician/gists{/gist_id}","starred_url":"https://api.github.com/users/everypolitician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everypolitician/subscriptions","organizations_url":"https://api.github.com/users/everypolitician/orgs","repos_url":"https://api.github.com/users/everypolitician/repos","events_url":"https://api.github.com/users/everypolitician/events{/privacy}","received_events_url":"https://api.github.com/users/everypolitician/received_events","type":"Organization","site_admin":false},"repo":{"id":48421321,"name":"everypolitician-ruby","full_name":"everypolitician/everypolitician-ruby","owner":{"login":"everypolitician","id":12497298,"avatar_url":"https://avatars.githubusercontent.com/u/12497298?v=3","gravatar_id":"","url":"https://api.github.com/users/everypolitician","html_url":"https://github.com/everypolitician","followers_url":"https://api.github.com/users/everypolitician/followers","following_url":"https://api.github.com/users/everypolitician/following{/other_user}","gists_url":"https://api.github.com/users/everypolitician/gists{/gist_id}","starred_url":"https://api.github.com/users/everypolitician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everypolitician/subscriptions","organizations_url":"https://api.github.com/users/everypolitician/orgs","repos_url":"https://api.github.com/users/everypolitician/repos","events_url":"https://api.github.com/users/everypolitician/events{/privacy}","received_events_url":"https://api.github.com/users/everypolitician/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/everypolitician/everypolitician-ruby","description":null,"fork":false,"url":"https://api.github.com/repos/everypolitician/everypolitician-ruby","forks_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/forks","keys_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/teams","hooks_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/hooks","issue_events_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/events","assignees_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/tags","blobs_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/languages","stargazers_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/stargazers","contributors_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/contributors","subscribers_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/subscribers","subscription_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/subscription","commits_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/merges","archive_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/downloads","issues_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/labels{/name}","releases_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/deployments","created_at":"2015-12-22T08:56:29Z","updated_at":"2016-01-26T12:50:48Z","pushed_at":"2016-07-12T11:40:03Z","git_url":"git://github.com/everypolitician/everypolitician-ruby.git","ssh_url":"git@github.com:everypolitician/everypolitician-ruby.git","clone_url":"https://github.com/everypolitician/everypolitician-ruby.git","svn_url":"https://github.com/everypolitician/everypolitician-ruby","homepage":null,"size":298,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"base":{"label":"everypolitician:master","ref":"master","sha":"ba9bf4dc5d16005811811db065a202c945f95bc4","user":{"login":"everypolitician","id":12497298,"avatar_url":"https://avatars.githubusercontent.com/u/12497298?v=3","gravatar_id":"","url":"https://api.github.com/users/everypolitician","html_url":"https://github.com/everypolitician","followers_url":"https://api.github.com/users/everypolitician/followers","following_url":"https://api.github.com/users/everypolitician/following{/other_user}","gists_url":"https://api.github.com/users/everypolitician/gists{/gist_id}","starred_url":"https://api.github.com/users/everypolitician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everypolitician/subscriptions","organizations_url":"https://api.github.com/users/everypolitician/orgs","repos_url":"https://api.github.com/users/everypolitician/repos","events_url":"https://api.github.com/users/everypolitician/events{/privacy}","received_events_url":"https://api.github.com/users/everypolitician/received_events","type":"Organization","site_admin":false},"repo":{"id":48421321,"name":"everypolitician-ruby","full_name":"everypolitician/everypolitician-ruby","owner":{"login":"everypolitician","id":12497298,"avatar_url":"https://avatars.githubusercontent.com/u/12497298?v=3","gravatar_id":"","url":"https://api.github.com/users/everypolitician","html_url":"https://github.com/everypolitician","followers_url":"https://api.github.com/users/everypolitician/followers","following_url":"https://api.github.com/users/everypolitician/following{/other_user}","gists_url":"https://api.github.com/users/everypolitician/gists{/gist_id}","starred_url":"https://api.github.com/users/everypolitician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everypolitician/subscriptions","organizations_url":"https://api.github.com/users/everypolitician/orgs","repos_url":"https://api.github.com/users/everypolitician/repos","events_url":"https://api.github.com/users/everypolitician/events{/privacy}","received_events_url":"https://api.github.com/users/everypolitician/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/everypolitician/everypolitician-ruby","description":null,"fork":false,"url":"https://api.github.com/repos/everypolitician/everypolitician-ruby","forks_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/forks","keys_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/teams","hooks_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/hooks","issue_events_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/events","assignees_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/tags","blobs_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/languages","stargazers_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/stargazers","contributors_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/contributors","subscribers_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/subscribers","subscription_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/subscription","commits_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/merges","archive_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/downloads","issues_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/labels{/name}","releases_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/everypolitician/everypolitician-ruby/deployments","created_at":"2015-12-22T08:56:29Z","updated_at":"2016-01-26T12:50:48Z","pushed_at":"2016-07-12T11:40:03Z","git_url":"git://github.com/everypolitician/everypolitician-ruby.git","ssh_url":"git@github.com:everypolitician/everypolitician-ruby.git","clone_url":"https://github.com/everypolitician/everypolitician-ruby.git","svn_url":"https://github.com/everypolitician/everypolitician-ruby","homepage":null,"size":298,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14"},"html":{"href":"https://github.com/everypolitician/everypolitician-ruby/pull/14"},"issue":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/14"},"comments":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/everypolitician/everypolitician-ruby/statuses/21e35bb3a6c1ff97f5ee31d1cc9620a1e07e55e9"}}}}
{"actor":{"display_login":"tmtmtmtm"}}