Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow memoized methods to be reloaded and allow multiple symbols
- Loading branch information
Showing
2 changed files
with
43 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 comments
on commit e1f23da
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.
Unless it’s run on debian
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.
It would probably be better to replace the random
calls with an incrementing instance variable. For instance:
class Person
def current_count
@count ||= 0
@count += 1
end
memoize :current_count
You can then reliably test expected values against the memoization.
This test will not always pass :-)