Sha256: f7a26a9d5122bb122b1955bddb69a753e9c67e1f8996f1debb69f6847027f49f
Contents?: true
Size: 531 Bytes
Versions: 2
Compression:
Stored size: 531 Bytes
Contents
# Mem Memoize any method call. ## Installation ``` gem install mem ``` ## Usage ```ruby class Foo include Mem def initialize @count = 0 end def bar baz end # `memoize` defines bar_with_memoize & bar_without_memoize, # and the result of the 1st method call is stored into @memoized_table. memoize :bar private def baz @count += 1 end end foo = Foo.new foo.bar #=> 1 foo.bar #=> 1 foo.bar #=> 1 foo.has_memoized?(:bar) #=> true foo.memoized(:bar) #=> 1 foo.memoized_table #=> { bar: 1 } ```
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mem-0.1.1 | README.md |
mem-0.1.0 | README.md |