unity-dependency-container 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 2ebccc95a98e2bb957d09819d66793e2a84aba0f29f6ba6a6173abbb8a9cf85c
4
- data.tar.gz: b77f544d0f1fc4317761b5ccb913d5a0695b011645301c937b336430c47cccb0
3
+ metadata.gz: 95ecbf88cb30fe3a940f14fecab38aac375994201c59fccbe9669a403505685a
4
+ data.tar.gz: c6a856fbb143079767b55d7f44ae31203269eb768f9dfe91c5016befd0428a20
5
5
  SHA512:
6
- metadata.gz: 10ae97b11f95e14207a1ebd551e01016dab0f4646b8ff8052239a856f05e933e4a9414ed6c01b39a51e412fda8c73fd0e120c40f0d19ed8a4e21dd6c7eb6e765
7
- data.tar.gz: b1ea601ca9bcace408908202827c0b07d95f9474dade8436d5efa81503aed7c8de3b87267171ff30fb5ad94871a13945f11edac90b122afde4500c6bda2e87ca
6
+ metadata.gz: c53afd56a4df8801ffbcadfa3019d1d79ca49b397eb91fc201974553c6264bf9afb6942c18094cbaac455840db2b5933b3f8b3c46b120cfedbedfb834dd292ed
7
+ data.tar.gz: 775347c35a72973fa59ec0497e02bf4a6386878b8b737c9d6bc67f308f56b9bbee1720c5146fde68643d41059cd6a29610250eed1afa463ca5aa191362a2f693
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Unity
4
4
  module DependencyContainer
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0'
6
6
  end
7
7
  end
@@ -11,11 +11,18 @@ module Unity
11
11
  end
12
12
 
13
13
  def di_instances
14
- @di_instances ||= {}
14
+ Thread.current[:di_instances]
15
15
  end
16
16
 
17
17
  def di(name)
18
- di_instances[name] ||= di_container_repository[name].call
18
+ return di_instances[name] if !di_instances.nil? && di_instances.key?(name)
19
+
20
+ Thread.current[:di_instances] ||= {}
21
+
22
+ unless di_container_repository.key?(name)
23
+ raise Error, "Dependency '#{name}' does not exists"
24
+ end
25
+ Thread.current[:di_instances][name] = di_container_repository[name].call
19
26
  end
20
27
 
21
28
  def dependency(name, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unity-dependency-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - saluzafa
@@ -27,6 +27,7 @@ files:
27
27
  - lib/unity-dependency-container.rb
28
28
  - lib/unity/dependency_container.rb
29
29
  - lib/unity/dependency_container/version.rb
30
+ - unity-dependency-container-1.0.0.gem
30
31
  homepage: https://github.com/pocketsizesun/unity-dependency-container
31
32
  licenses: []
32
33
  metadata: