{"action":"created","issue":{"url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/issues/209","repository_url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm","labels_url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/issues/209/comments","events_url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/issues/209/events","html_url":"https://github.com/projecthydra-labs/hydra-pcdm/pull/209","id":145034130,"number":209,"title":"Removing memoized object as query is stateless","user":{"login":"jeremyf","id":2130,"avatar_url":"https://avatars.githubusercontent.com/u/2130?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyf","html_url":"https://github.com/jeremyf","followers_url":"https://api.github.com/users/jeremyf/followers","following_url":"https://api.github.com/users/jeremyf/following{/other_user}","gists_url":"https://api.github.com/users/jeremyf/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyf/subscriptions","organizations_url":"https://api.github.com/users/jeremyf/orgs","repos_url":"https://api.github.com/users/jeremyf/repos","events_url":"https://api.github.com/users/jeremyf/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-31T22:20:09Z","updated_at":"2016-04-01T16:22:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/pulls/209","html_url":"https://github.com/projecthydra-labs/hydra-pcdm/pull/209","diff_url":"https://github.com/projecthydra-labs/hydra-pcdm/pull/209.diff","patch_url":"https://github.com/projecthydra-labs/hydra-pcdm/pull/209.patch"},"body":"## Removing memoized object as query is stateless\r\n\r\n@7fd3cf9155d3707aaec48f14cefed6ddd02c37e7\r\n\r\nThere was not a benefit to memoizing the AncestorChecker object. So I\r\nopted to remove the memoization and favor a module function.\r\n\r\nI also did some parameter renaming to reflect that the parameter names\r\nswitched meaning across the call into the AncestorChecker.\r\n\r\nAnd finally added a missing spec for potential deep ancestry.\r\n\r\n## Replacing unnecessary object creation\r\n\r\n@f2c5c7af9c2a2032b30ab3b06c56964acccd6c93\r\n\r\nIn looking at the gemspec requirements, I see that Hydra::PCDM is for\r\nruby 1.9.3 or greater. This means no keyword args. So instead of using\r\nthe shim of hash keys, I've replaced them with positional args. This\r\nreduces the number of hashes created on the method call.\r\n\r\nI have also replaced the DeepMemberIterator logic with a recursive\r\nmethod call. Consider the two scenarios, one using DeepMemberIterator\r\nand the other using method calls and some duck typing:\r\n\r\n```ruby\r\nrecord.members == [a, b, c]\r\na.members == [d, e, f, g]\r\nb.members == [h, i]\r\nc.members == [j, k]\r\nk.members == [l, m, n, o, p]\r\n```\r\n\r\nWhen DeepMemberIterator is used in the above scenario, we will\r\ninstantiate approximately:\r\n\r\n* 17 instances of Hydra::PCDM::HasMembers\r\n* 17 instances of Hydra::PCDM::DeepMemberIterator\r\n* And loop twice through each of `[a,b,c]`, `[d, e, f, g]`, `[h, i]`,\r\n  `[j, k]`, and `[l, m, n, o, p]`\r\n\r\n## Removing DeepMemberIterator\r\n\r\n@aba866c1b5f73dc52fc62ee44b577859b179843b\r\n\r\nBased on the previous commit, the DeepMemberIterator is not needed.\r\nI checked through the two organizations (i.e. projectyhdra and\r\nprojecthydra-labs) for any additional uses of DeepMemberIterator, and\r\nfound none.\r\n\r\nPerhaps this should be deprecated instead. I don't know if the class is\r\npart of the public api or not.\r\n\r\n(If it isn't perhaps we should mark the constant as a private constant\r\nor document it as @api private)?\r\n"},"comment":{"url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/issues/comments/204458676","html_url":"https://github.com/projecthydra-labs/hydra-pcdm/pull/209#issuecomment-204458676","issue_url":"https://api.github.com/repos/projecthydra-labs/hydra-pcdm/issues/209","id":204458676,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T16:22:54Z","updated_at":"2016-04-01T16:22:54Z","body":"\n[![Coverage Status](https://coveralls.io/builds/5631027/badge)](https://coveralls.io/builds/5631027)\n\nCoverage remained the same at 100.0% when pulling **aba866c1b5f73dc52fc62ee44b577859b179843b on remove-memoized-object-in-which-state-is-unneeded** into **511caf81d6d7ad826b86578ec2c63aac9b2038cf on master**.\n"}}