hypo 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hypo/container.rb +7 -1
- data/lib/hypo/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: 1671c3b418f72e704152244916967ebe0c2288d4
|
4
|
+
data.tar.gz: 55fde3998486b713e045de9878e45fa5ac336242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcd9ba4639e366d6f74f7275561aa9bc4c2a84c16907f7521dfb07c63564d8d4dcf9f011b7ff68738a8108ee3c7747d3eb6c48371d79f69aa7a25af052d76fe2
|
7
|
+
data.tar.gz: 267d919d6d1c9a2316747c47a3f94f95072a55137972cd8aa93ee4c471577b298fc7d165dc959f0ee9842afba1e3cd0a49666bb015789a3a392acad84104fdf7
|
data/lib/hypo/container.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'hypo/container_error'
|
2
2
|
require 'hypo/component'
|
3
3
|
require 'hypo/instance'
|
4
|
+
require 'hypo/life_cycle/transient'
|
5
|
+
require 'hypo/life_cycle/singleton'
|
4
6
|
|
5
7
|
module Hypo
|
6
8
|
class Container
|
@@ -19,7 +21,7 @@ module Hypo
|
|
19
21
|
component = type.new(item, self, name)
|
20
22
|
|
21
23
|
if @components.key?(component.name)
|
22
|
-
raise ContainerError, "Component
|
24
|
+
raise ContainerError, "Component \"#{component.name}\" has already been registered"
|
23
25
|
end
|
24
26
|
|
25
27
|
@components[component.name] = component
|
@@ -33,6 +35,10 @@ module Hypo
|
|
33
35
|
@components[name].instance
|
34
36
|
end
|
35
37
|
|
38
|
+
def remove(name)
|
39
|
+
@components.delete(name)
|
40
|
+
end
|
41
|
+
|
36
42
|
def add_life_cycle(life_cycle, name)
|
37
43
|
@life_cycles[name] = life_cycle
|
38
44
|
|
data/lib/hypo/version.rb
CHANGED