ioc 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ioc.gemspec +1 -1
- data/lib/ioc.rb +6 -0
- data/spec/ioc_spec.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d74cd8f28348bde6d237602eab9f19a35483152
|
4
|
+
data.tar.gz: fe5e748bfbb204763e1285487d0601c59c5d3dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b6862816c763988e82a8d484205fa8ed5fa233fa9ca8d77fbdc8f1b4e1c28dfb8c64df5f877b2e22c7ea2b4746b531ac6b3bfc84f67bbd4abcb955b125dc0e
|
7
|
+
data.tar.gz: f7f162920ae8bfed59bcf3cd1656cc0b8236fe2f434ba9c9126ba6d77a9f8c8712f921fa72c129bd8984751cfc976cdae6987bf71c7a5c4d38216da8b4c98d48
|
data/ioc.gemspec
CHANGED
data/lib/ioc.rb
CHANGED
data/spec/ioc_spec.rb
CHANGED
@@ -9,7 +9,9 @@ class CarFixture
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
class
|
12
|
+
class PropulsionFixture; end
|
13
|
+
class EngineFixture < PropulsionFixture; end
|
14
|
+
class MotorFixture < PropulsionFixture; end
|
13
15
|
|
14
16
|
describe IOC do
|
15
17
|
it "can resolve a service class" do
|
@@ -42,6 +44,15 @@ describe IOC do
|
|
42
44
|
container.resolve(:myobject).must_equal(myobject)
|
43
45
|
end
|
44
46
|
|
47
|
+
it "iterate through registrants by type" do
|
48
|
+
container = IOC::Container.new
|
49
|
+
container.register(:engine, EngineFixture)
|
50
|
+
container.register(:motor, MotorFixture)
|
51
|
+
services = {}
|
52
|
+
container.each_type(PropulsionFixture) {|key, service| services[key] = service}
|
53
|
+
services.must_equal(:engine => EngineFixture, :motor => MotorFixture)
|
54
|
+
end
|
55
|
+
|
45
56
|
it "complains when resolving unknown service" do
|
46
57
|
container = IOC::Container.new
|
47
58
|
proc {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ioc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Lott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|