mem 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/mem/version.rb +1 -1
- data/lib/mem.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f73463cfd8433821a0bcf5965e3723f5664108c
|
4
|
+
data.tar.gz: ef54399be1bd91d4e7c6e4578cb664a7b50a83e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afe455e5ff5efe99f0ebd6e80535fec3e2eff047aa1274caec7a601c10000767901554699c94dfbd96ef8560cc9b02ec63bf44574d8dc5906ec62e17226b6ba4
|
7
|
+
data.tar.gz: 225b1a658713bb109863af892609ed60ddf61463b671509745fe6c3d52a3b1664e47044b197e91e97cb774ad5c92915fa4600532c31da94f783c5b234ca7b26c
|
data/CHANGELOG.md
CHANGED
data/lib/mem/version.rb
CHANGED
data/lib/mem.rb
CHANGED
@@ -21,6 +21,10 @@ module Mem
|
|
21
21
|
@memoized_table ||= {}
|
22
22
|
end
|
23
23
|
|
24
|
+
def unmemoize(key)
|
25
|
+
memoized_table.delete(key)
|
26
|
+
end
|
27
|
+
|
24
28
|
module ClassMethods
|
25
29
|
def memoize(method_name)
|
26
30
|
define_method("#{method_name}_with_memoize") do |*args, &block|
|
@@ -33,6 +37,10 @@ module Mem
|
|
33
37
|
alias_method "#{method_name}_without_memoize", method_name
|
34
38
|
alias_method method_name, "#{method_name}_with_memoize"
|
35
39
|
|
40
|
+
define_method("unmemoize_#{method_name}") do
|
41
|
+
unmemoize(method_name)
|
42
|
+
end
|
43
|
+
|
36
44
|
define_method("#{method_name}=") do |value|
|
37
45
|
memoize(method_name, value)
|
38
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|