memmo 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ 0.0.2 - 2013-01-16
2
+
3
+ * Add support for lock re-entrancy for keys depending on one another.
4
+
5
+ 0.0.1 - 2013-01-09
6
+
7
+ * Initial release.
data/README.md CHANGED
@@ -42,3 +42,8 @@ require "test/unit"
42
42
 
43
43
  Memmo.enabled = false
44
44
  ```
45
+
46
+ License
47
+ -------
48
+
49
+ See `UNLICENSE`. With love, from [Educabilia](http://educabilia.com).
@@ -1,3 +1,5 @@
1
+ require "monitor"
2
+
1
3
  class Memmo
2
4
  def self.enabled
3
5
  @enabled
@@ -8,7 +10,7 @@ class Memmo
8
10
  end
9
11
 
10
12
  def initialize
11
- @mutex = Mutex.new
13
+ @mutex = Monitor.new
12
14
  @loaders = {}
13
15
  @cache = {}
14
16
  end
@@ -1,3 +1,3 @@
1
1
  module Memmo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -62,6 +62,19 @@ class MemmoTest < Test::Unit::TestCase
62
62
  assert_equal 2, calls
63
63
  end
64
64
 
65
+ def test_reentrancy
66
+ @memmo.register(:foo, ttl: 0) do
67
+ :foo
68
+ end
69
+
70
+ @memmo.register(:bar) do
71
+ @memmo[:foo]
72
+ end
73
+
74
+ assert_equal :foo, @memmo[:foo]
75
+ assert_equal :foo, @memmo[:bar]
76
+ end
77
+
65
78
  def teardown
66
79
  Memmo.enabled = true
67
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-09 00:00:00.000000000 Z
13
+ date: 2013-01-16 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description:
16
16
  email:
@@ -21,6 +21,7 @@ extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
23
  - .gitignore
24
+ - CHANGELOG
24
25
  - README.md
25
26
  - UNLICENSE
26
27
  - lib/memmo.rb