Module: FondMemos
- Defined in:
- lib/fond_memos.rb,
lib/fond_memos/version.rb
Overview
foo = Foo.new foo.bar # expensive foo.bar # fast foo.forget(:bar) foo.bar # expensive again (why did you forget?) foo.bar # fast again (that’s better)
If you memoize a method with arguments, the #hash method will be called on each argument to generate a key to use in FondMemo’s internal hash. To ensure safe and responsible memoizing, it is strongly encouraged to ensure your memoized method arguments have logical hash values.
May you always have fond memos of using this gem!
Defined Under Namespace
Modules: ClassMethods, Internal
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#forget(method) ⇒ Object
Calling this will remove the caching instance variable for the method.
Class Method Details
.included(base) ⇒ Object
32 33 34 |
# File 'lib/fond_memos.rb', line 32 def self.included(base) base.extend ClassMethods end |