regstry 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/registry.rb +9 -0
- data/lib/registry/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29e1d8a8734679d3d187886b34ec17b97a550922
|
4
|
+
data.tar.gz: c22431afadfd84d7b01d3449534c9316c8d61763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b195a4aeec15976a29e6e873aea6f7bc0b97b7f3fa79d29e17b96b95c886354aad454f3a6f72c9e46c6845ec05f9370a8e68010ac970c94208f00db89496ebb5
|
7
|
+
data.tar.gz: b2240d49d2d825b6c251db4fcf6d0003c25f20ea505615c6c53dc5e418fbb64246e57967c2115a8ebac83e0329e7efd711129708051605d19bd775a6a6af2103
|
data/lib/registry.rb
CHANGED
@@ -48,6 +48,10 @@ module Registry
|
|
48
48
|
key && objects[key.to_sym] || raise(UnknownKey, MSGS[:unknown] % [key, objects.keys.sort])
|
49
49
|
end
|
50
50
|
|
51
|
+
def delete(key)
|
52
|
+
objects.delete(key)
|
53
|
+
end
|
54
|
+
|
51
55
|
def objects
|
52
56
|
@objects ||= {}
|
53
57
|
end
|
@@ -78,6 +82,11 @@ module Registry
|
|
78
82
|
registry[key] = obj
|
79
83
|
end
|
80
84
|
|
85
|
+
def unregister(obj = self)
|
86
|
+
registry.delete(obj.registry_key)
|
87
|
+
obj.remove_instance_variable(:@registry_key)
|
88
|
+
end
|
89
|
+
|
81
90
|
def registered?(key)
|
82
91
|
registry.key?(key && key.to_sym)
|
83
92
|
end
|
data/lib/registry/version.rb
CHANGED