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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be1e9f31995ff9a66dd6e93d6adbdee9532073f4
4
- data.tar.gz: 1e9b78d932ed38142364508403e9302574ad0ec5
3
+ metadata.gz: 1f73463cfd8433821a0bcf5965e3723f5664108c
4
+ data.tar.gz: ef54399be1bd91d4e7c6e4578cb664a7b50a83e1
5
5
  SHA512:
6
- metadata.gz: 6aedfaa4c3e4b4f0bdd7d02b03f1b07c2b3f185a8fc8ce4d641077ab1cb732060b7e12e865d4d8d0462f0c573c0fc4fe420a692700226527a6adae3f05bd9593
7
- data.tar.gz: 19fa71af0132cbb284bbf7e31f56dd452e90c35b8183a0714cbe4e0c3902bc3ebf45cdd11abbcf3c995491bb4cdc48d8e57a7388ba2940f91163ff73235429a1
6
+ metadata.gz: afe455e5ff5efe99f0ebd6e80535fec3e2eff047aa1274caec7a601c10000767901554699c94dfbd96ef8560cc9b02ec63bf44574d8dc5906ec62e17226b6ba4
7
+ data.tar.gz: 225b1a658713bb109863af892609ed60ddf61463b671509745fe6c3d52a3b1664e47044b197e91e97cb774ad5c92915fa4600532c31da94f783c5b234ca7b26c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.4
2
+ * Add support for removing memoization
3
+
1
4
  ## 0.1.3
2
5
  * Support memoize/core_ext only use
3
6
 
data/lib/mem/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mem
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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.3
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-01 00:00:00.000000000 Z
11
+ date: 2014-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler