Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensuring self-contained memoization of method (#725)
Prior to this commit, the guard condition `return self.collection_ids if collections_created?` served as memoization (e.g. caching the results of an expensive operation). However, it was not a self-contained memoization (e.g. the method is fully in charge of managing the memoization). It instead relied on the previous implementation of `#collections_created?`. Downstream implementations may change `#collection_created?` which could create unintended consenquences of assignign collections based on the OAI spec. Also, if we look to other implementations in Bulkrax of `#collections_created?` we see that many simply `return true`. The impact of the previous code is that were someone to make the above change (e.g. always `return true`), we end up never assigning any `setSpec` `collection_ids` and always returning `[]` for `#find_collection_ids`. dependent on external methods. With this commit, we are internalizing the memoization mechanism so that this method is less dependent on external factories. For further discussion of the interplay of the methods regarding collection creation see the [comments found here][1]. References: - scientist-softserv/adventist-dl#247 - https://github.com/scientist-softserv/adventist-dl/issues/240 [1]: https://github.com/scientist-softserv/adventist-dl/issues/240#issuecomment-1412456590
- Loading branch information