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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1bd6c3f92ed36c1c2cbabbf38e84ba5329235575
4
- data.tar.gz: 3daa123bcd92d20483b80170faca117c0d7feaec
3
+ metadata.gz: 29e1d8a8734679d3d187886b34ec17b97a550922
4
+ data.tar.gz: c22431afadfd84d7b01d3449534c9316c8d61763
5
5
  SHA512:
6
- metadata.gz: 4ed6ddc1b97f1efee615490ea81d1430255312513daab6e4681e5a8d7b77340e57ce3f08166c49c591264f5ff8472273165aa41bef4d677977446ce6a07e7312
7
- data.tar.gz: 7e645a0ae97644121c4628353baec5f423609a9ab25131711fec454575e3a241868e8245b986bb004f58c6bd3b0731030addbdb904670403b1fb08ef2e7e0015
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
@@ -1,3 +1,3 @@
1
1
  module Registry
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regstry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs