weak_hash 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +10 -10
  2. data/VERSION +1 -1
  3. data/lib/weak_hash.rb +1 -1
  4. metadata +3 -3
@@ -6,27 +6,27 @@ reclaim the object.
6
6
 
7
7
  The API is similar to that of a Hash:
8
8
 
9
- object = Object.new
9
+ object = Object.new
10
10
 
11
- wh = WeakHash.new
12
- wh["value"] = object
11
+ wh = WeakHash.new
12
+ wh["value"] = object
13
13
 
14
- wh["value"] # => object
14
+ wh["value"] # => object
15
15
 
16
- object = nil
17
- wh["value"] # => object (if garbage collector has not collected the object yet)
16
+ object = nil
17
+ wh["value"] # => object (if garbage collector has not collected the object yet)
18
18
 
19
- GC.start; GC.start # very probable that the object is collected now.
19
+ GC.start; GC.start # very probable that the object is collected now.
20
20
 
21
- wh["value"] # => nil
21
+ wh["value"] # => nil
22
22
 
23
23
  == Credits
24
24
 
25
25
  This gem is based on two blog posts by Mauricio Fernández, including code by
26
26
  him and Robert Klemme:
27
27
 
28
- http://eigenclass.org/hiki/weakhash+and+weakref
29
- http://eigenclass.org/hiki/deferred-finalizers-in-Ruby
28
+ * http://eigenclass.org/hiki/weakhash+and+weakref
29
+ * http://eigenclass.org/hiki/deferred-finalizers-in-Ruby
30
30
 
31
31
  I wrapped this on a gem for convenience, replaced a Thread.critical call
32
32
  on SimpleWeakHash with a mutex (for making it work with 1.9) and
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -48,7 +48,7 @@ class WeakHash
48
48
  # as long as it isn't garbage collected.
49
49
  def []=( key, value )
50
50
  case key
51
- when Fixnum, Symbol, true, false
51
+ when Fixnum, Symbol, true, false, nil
52
52
  key2 = key
53
53
  else
54
54
  key2 = key.dup
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Emmanuel Oga
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-08 00:00:00 -03:00
17
+ date: 2010-03-16 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency