Open omgitsbillryan opened 7 years ago
FWIW you can hack around this with something like Foo.remove_instance_variable(:@_memoized_bar)
.
Not pretty but half a loaf is better than none!
Can this be closed?
I believe so. Just ran a manual test:
2.3.0 :001 > class Foo
2.3.0 :002?> class << self
2.3.0 :003?> extend Memoist
2.3.0 :004?>
2.3.0 :005 > def bar
2.3.0 :006?> "hello"
2.3.0 :007?> end
2.3.0 :008?> memoize :bar
2.3.0 :009?>
2.3.0 :010 > end
2.3.0 :011?> end
=> :bar
2.3.0 :012 > Foo.bar
=> "hello"
2.3.0 :013 > Foo.flush_cache
=> [#<struct Memoist::MemoizedMethod memoized_method=:bar, ivar="@_memoized_bar", arity=0>]
2.3.0 :014 >
Given a class:
Foo.flush_cache
spits out:I also found this related issue: https://github.com/matthewrudy/memoist/issues/54