serializable_decorator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Delegators
2
2
  module SerializableDecorator
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -14,10 +14,15 @@ class SerializableDecorator < Delegator
14
14
  @@decorator_objects[decorator.object_id]
15
15
  end
16
16
 
17
+ def self.clear_obj(object_id)
18
+ proc { @@decorator_objects.delete(object_id) }
19
+ end
20
+
17
21
  def initialize(obj)
18
22
  super
19
23
  SerializableDecorator.change_obj(self, obj)
20
- end
24
+ ObjectSpace.define_finalizer( self, self.class.clear_obj(object_id) )
25
+ end
21
26
 
22
27
  def __getobj__
23
28
  SerializableDecorator.get_obj(self)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serializable_decorator
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:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-20 00:00:00.000000000 Z
12
+ date: 2012-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json