【文件属性】:
文件名称:mem:记住任何方法调用
文件大小:5KB
文件格式:ZIP
更新时间:2021-06-28 20:45:12
Ruby
内存
记住任何方法调用。
安装
gem install mem
用法
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_memoiz
【文件预览】:
mem-master
----.gitignore(154B)
----README.md(796B)
----mem.gemspec(805B)
----CHANGELOG.md(445B)
----Gemfile(88B)
----spec()
--------mem_spec.rb(2KB)
--------spec_helper.rb(246B)
----LICENSE.txt(1KB)
----lib()
--------mem()
--------mem.rb(1KB)
----Rakefile(113B)