-
Notifications
You must be signed in to change notification settings - Fork 0
Fix double memoization bug #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
tristil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍰
bryan-ash
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍖 🏅
Previously, calling `memoize` with the same method name more than once would result in a perpetual loop when calling that method. This commit fixes the bug. Memoizer now keeps track of which methods have been memoized and avoids trying to memoize an already-memoized method.
This commit changes the implementation of the `memoizer_memoized_methods` variable to use a hash instead of an array so that the lookup is constant time.
Only the patch version has been bumped. Changes since the previous version should be backwards-compatible with all tested versions of ruby. Co-authored-by: Nathan Fixler <nathan.fixler@appfolio.com>
5bee81b to
de5ccae
Compare
|
Why is this stuck? |
|
@fixlr can you see this? |
|
Merging this would also allow for improving the Now that we have an array of memoized methods ( |
|
JFYI, I've added similar spec to my |
From the relevant commit: