{"action":"created","comment":{"url":"https://api.github.com/repos/dpla/heidrun/pulls/comments/41033367","id":41033367,"diff_hunk":"@@ -0,0 +1,209 @@\n+module Heidrun\n+  module MappingTools\n+    ##\n+    # Static methods for evaluations and assignments that can be shared between\n+    # mappings of MARC providers.\n+    #\n+    module MARC\n+      require_relative 'marc/genre'\n+      require_relative 'marc/dctype'\n+      require_relative 'marc/dcformat'\n+\n+      module_function\n+\n+      ##\n+      # Given options representing leader and controlfield values, return an\n+      # array of applicable genre (edm:hasType) controlled-vocabulary terms\n+      #\n+      # Options are as follows, and are all Strings:\n+      #   - leader:  value of MARC 'leader' element\n+      #   - cf_007:  value of MARC 'controlfield' with 'tag' attribute '007'\n+      #   - cf_008:  value of MARC 'controlfield' with 'tag' attribute '008'\n+      #   - cf_970a:  TODO\n+      #\n+      # @param opts [Hash] Options, as outlined above\n+      # @return [Array]\n+      def genre(opts)\n+        genres = []\n+        args = [genres, opts]\n+        # TODO: insert handling of optional cf_970a for Hathi, as the first\n+        # evaluation.\n+        Genre.assign_language(*args) || Genre.assign_musical_score(*args) \\\n+          || Genre.assign_manuscript(*args) || Genre.assign_maps(*args) \\\n+          || Genre.assign_projected(*args) || Genre.assign_two_d(*args) \\\n+          || Genre.assign_nonmusical_sound(*args) \\\n+          || Genre.assign_musical_sound(*args)\n+        genres << 'Government Document' \\\n+          if Genre.government_document?(opts[:cf_008])\n+        genres\n+      end\n+\n+      def dctype(opts)\n+        types = []\n+        args = [types, opts]\n+        DCType.assign_337a(*args)\n+        DCType.assign_text(*args) \\","path":"lib/heidrun/mapping_tools/marc.rb","position":45,"original_position":45,"commit_id":"acef6da019dc7bdc649db8fb1ca280ac74569358","original_commit_id":"acef6da019dc7bdc649db8fb1ca280ac74569358","user":{"login":"markbreedlove","id":5550828,"avatar_url":"https://avatars.githubusercontent.com/u/5550828?v=3","gravatar_id":"","url":"https://api.github.com/users/markbreedlove","html_url":"https://github.com/markbreedlove","followers_url":"https://api.github.com/users/markbreedlove/followers","following_url":"https://api.github.com/users/markbreedlove/following{/other_user}","gists_url":"https://api.github.com/users/markbreedlove/gists{/gist_id}","starred_url":"https://api.github.com/users/markbreedlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbreedlove/subscriptions","organizations_url":"https://api.github.com/users/markbreedlove/orgs","repos_url":"https://api.github.com/users/markbreedlove/repos","events_url":"https://api.github.com/users/markbreedlove/events{/privacy}","received_events_url":"https://api.github.com/users/markbreedlove/received_events","type":"User","site_admin":false},"body":"The former, with the operator appearing on the second line, so you don't have to look up to the line above to understand the context of the line in question.  (I read from top to bottom, left to right. My eye can scan it more easily.)  This is consistent with what I'm used to seeing in other languages, too, and I think a lot of people will probably be used to expecting it that way.\r\n","created_at":"2015-10-02T15:24:40Z","updated_at":"2015-10-02T15:24:40Z","html_url":"https://github.com/dpla/heidrun/pull/32#discussion_r41033367","pull_request_url":"https://api.github.com/repos/dpla/heidrun/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/dpla/heidrun/pulls/comments/41033367"},"html":{"href":"https://github.com/dpla/heidrun/pull/32#discussion_r41033367"},"pull_request":{"href":"https://api.github.com/repos/dpla/heidrun/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/dpla/heidrun/pulls/32","id":43328298,"html_url":"https://github.com/dpla/heidrun/pull/32","diff_url":"https://github.com/dpla/heidrun/pull/32.diff","patch_url":"https://github.com/dpla/heidrun/pull/32.patch","issue_url":"https://api.github.com/repos/dpla/heidrun/issues/32","number":32,"state":"open","locked":false,"title":"Add Heidrun::MappingTools","user":{"login":"markbreedlove","id":5550828,"avatar_url":"https://avatars.githubusercontent.com/u/5550828?v=3","gravatar_id":"","url":"https://api.github.com/users/markbreedlove","html_url":"https://github.com/markbreedlove","followers_url":"https://api.github.com/users/markbreedlove/followers","following_url":"https://api.github.com/users/markbreedlove/following{/other_user}","gists_url":"https://api.github.com/users/markbreedlove/gists{/gist_id}","starred_url":"https://api.github.com/users/markbreedlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbreedlove/subscriptions","organizations_url":"https://api.github.com/users/markbreedlove/orgs","repos_url":"https://api.github.com/users/markbreedlove/repos","events_url":"https://api.github.com/users/markbreedlove/events{/privacy}","received_events_url":"https://api.github.com/users/markbreedlove/received_events","type":"User","site_admin":false},"body":"See https://github.com/dpla/heidrun-mappings/pull/28\r\n\r\nAdd `Heidrun::MappingTools` module to assist with certain mapping operations.\r\n","created_at":"2015-08-25T19:48:12Z","updated_at":"2015-10-02T15:24:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dbe1525ed910e0265b2238edc23e1065c746e7a","assignee":{"login":"no-reply","id":1361776,"avatar_url":"https://avatars.githubusercontent.com/u/1361776?v=3","gravatar_id":"","url":"https://api.github.com/users/no-reply","html_url":"https://github.com/no-reply","followers_url":"https://api.github.com/users/no-reply/followers","following_url":"https://api.github.com/users/no-reply/following{/other_user}","gists_url":"https://api.github.com/users/no-reply/gists{/gist_id}","starred_url":"https://api.github.com/users/no-reply/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/no-reply/subscriptions","organizations_url":"https://api.github.com/users/no-reply/orgs","repos_url":"https://api.github.com/users/no-reply/repos","events_url":"https://api.github.com/users/no-reply/events{/privacy}","received_events_url":"https://api.github.com/users/no-reply/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/dpla/heidrun/pulls/32/commits","review_comments_url":"https://api.github.com/repos/dpla/heidrun/pulls/32/comments","review_comment_url":"https://api.github.com/repos/dpla/heidrun/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dpla/heidrun/issues/32/comments","statuses_url":"https://api.github.com/repos/dpla/heidrun/statuses/acef6da019dc7bdc649db8fb1ca280ac74569358","head":{"label":"dpla:feature/add-mapping-tools","ref":"feature/add-mapping-tools","sha":"acef6da019dc7bdc649db8fb1ca280ac74569358","user":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"repo":{"id":24336212,"name":"heidrun","full_name":"dpla/heidrun","owner":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dpla/heidrun","description":":goat: Heiðrún ingests metadata","fork":false,"url":"https://api.github.com/repos/dpla/heidrun","forks_url":"https://api.github.com/repos/dpla/heidrun/forks","keys_url":"https://api.github.com/repos/dpla/heidrun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpla/heidrun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpla/heidrun/teams","hooks_url":"https://api.github.com/repos/dpla/heidrun/hooks","issue_events_url":"https://api.github.com/repos/dpla/heidrun/issues/events{/number}","events_url":"https://api.github.com/repos/dpla/heidrun/events","assignees_url":"https://api.github.com/repos/dpla/heidrun/assignees{/user}","branches_url":"https://api.github.com/repos/dpla/heidrun/branches{/branch}","tags_url":"https://api.github.com/repos/dpla/heidrun/tags","blobs_url":"https://api.github.com/repos/dpla/heidrun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpla/heidrun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpla/heidrun/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpla/heidrun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpla/heidrun/statuses/{sha}","languages_url":"https://api.github.com/repos/dpla/heidrun/languages","stargazers_url":"https://api.github.com/repos/dpla/heidrun/stargazers","contributors_url":"https://api.github.com/repos/dpla/heidrun/contributors","subscribers_url":"https://api.github.com/repos/dpla/heidrun/subscribers","subscription_url":"https://api.github.com/repos/dpla/heidrun/subscription","commits_url":"https://api.github.com/repos/dpla/heidrun/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpla/heidrun/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpla/heidrun/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpla/heidrun/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpla/heidrun/contents/{+path}","compare_url":"https://api.github.com/repos/dpla/heidrun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpla/heidrun/merges","archive_url":"https://api.github.com/repos/dpla/heidrun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpla/heidrun/downloads","issues_url":"https://api.github.com/repos/dpla/heidrun/issues{/number}","pulls_url":"https://api.github.com/repos/dpla/heidrun/pulls{/number}","milestones_url":"https://api.github.com/repos/dpla/heidrun/milestones{/number}","notifications_url":"https://api.github.com/repos/dpla/heidrun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpla/heidrun/labels{/name}","releases_url":"https://api.github.com/repos/dpla/heidrun/releases{/id}","created_at":"2014-09-22T16:25:51Z","updated_at":"2015-09-22T09:59:15Z","pushed_at":"2015-10-01T23:34:28Z","git_url":"git://github.com/dpla/heidrun.git","ssh_url":"git@github.com:dpla/heidrun.git","clone_url":"https://github.com/dpla/heidrun.git","svn_url":"https://github.com/dpla/heidrun","homepage":"http://bit.ly/heidrun","size":832,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":7,"default_branch":"develop"}},"base":{"label":"dpla:develop","ref":"develop","sha":"01b36d7a18f8b2a125e080c0965c78361c10e7f7","user":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"repo":{"id":24336212,"name":"heidrun","full_name":"dpla/heidrun","owner":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dpla/heidrun","description":":goat: Heiðrún ingests metadata","fork":false,"url":"https://api.github.com/repos/dpla/heidrun","forks_url":"https://api.github.com/repos/dpla/heidrun/forks","keys_url":"https://api.github.com/repos/dpla/heidrun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpla/heidrun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpla/heidrun/teams","hooks_url":"https://api.github.com/repos/dpla/heidrun/hooks","issue_events_url":"https://api.github.com/repos/dpla/heidrun/issues/events{/number}","events_url":"https://api.github.com/repos/dpla/heidrun/events","assignees_url":"https://api.github.com/repos/dpla/heidrun/assignees{/user}","branches_url":"https://api.github.com/repos/dpla/heidrun/branches{/branch}","tags_url":"https://api.github.com/repos/dpla/heidrun/tags","blobs_url":"https://api.github.com/repos/dpla/heidrun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpla/heidrun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpla/heidrun/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpla/heidrun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpla/heidrun/statuses/{sha}","languages_url":"https://api.github.com/repos/dpla/heidrun/languages","stargazers_url":"https://api.github.com/repos/dpla/heidrun/stargazers","contributors_url":"https://api.github.com/repos/dpla/heidrun/contributors","subscribers_url":"https://api.github.com/repos/dpla/heidrun/subscribers","subscription_url":"https://api.github.com/repos/dpla/heidrun/subscription","commits_url":"https://api.github.com/repos/dpla/heidrun/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpla/heidrun/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpla/heidrun/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpla/heidrun/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpla/heidrun/contents/{+path}","compare_url":"https://api.github.com/repos/dpla/heidrun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpla/heidrun/merges","archive_url":"https://api.github.com/repos/dpla/heidrun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpla/heidrun/downloads","issues_url":"https://api.github.com/repos/dpla/heidrun/issues{/number}","pulls_url":"https://api.github.com/repos/dpla/heidrun/pulls{/number}","milestones_url":"https://api.github.com/repos/dpla/heidrun/milestones{/number}","notifications_url":"https://api.github.com/repos/dpla/heidrun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpla/heidrun/labels{/name}","releases_url":"https://api.github.com/repos/dpla/heidrun/releases{/id}","created_at":"2014-09-22T16:25:51Z","updated_at":"2015-09-22T09:59:15Z","pushed_at":"2015-10-01T23:34:28Z","git_url":"git://github.com/dpla/heidrun.git","ssh_url":"git@github.com:dpla/heidrun.git","clone_url":"https://github.com/dpla/heidrun.git","svn_url":"https://github.com/dpla/heidrun","homepage":"http://bit.ly/heidrun","size":832,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":7,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/dpla/heidrun/pulls/32"},"html":{"href":"https://github.com/dpla/heidrun/pull/32"},"issue":{"href":"https://api.github.com/repos/dpla/heidrun/issues/32"},"comments":{"href":"https://api.github.com/repos/dpla/heidrun/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/dpla/heidrun/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/dpla/heidrun/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dpla/heidrun/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/dpla/heidrun/statuses/acef6da019dc7bdc649db8fb1ca280ac74569358"}}}}