ioc 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ioc/container.rb +9 -6
- data/lib/ioc/version.rb +1 -1
- data/spec/ioc_spec.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: 5cb8ce6e01a3cca2df893843489987645885b6f3
|
4
|
+
data.tar.gz: 023f597d968c21b40dc1db1237c377c17326263b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ae48707d1beff5059ffe3aff5ba5f73e4e479dc156895ad17b549f72089e31662e0d2eebba68f6b385572692a787502088799e3bba796ef7a2ce99293faf39
|
7
|
+
data.tar.gz: 0df16432e752a310a61dee8fd42e6560250daf4ac302f940f706dfc9d57520baf8178050ffaa53419ddb09e9ac275bc38943a9fe6b33cdc1106f555432ffacd9
|
data/lib/ioc/container.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
module IOC
|
2
2
|
class Container
|
3
3
|
|
4
|
-
def self.install(
|
5
|
-
[
|
6
|
-
|
7
|
-
|
4
|
+
def self.install(options)
|
5
|
+
installers = options[:installers] || []
|
6
|
+
parent = options[:parent]
|
7
|
+
container = new(parent)
|
8
|
+
[*installers].inject(container) do |c, installer|
|
9
|
+
installer.install(c)
|
10
|
+
c
|
8
11
|
end
|
9
12
|
end
|
10
13
|
|
11
|
-
def initialize(parent=
|
14
|
+
def initialize(parent=nil, resolver_factory=ResolverFactory)
|
12
15
|
@resolver_factory = resolver_factory
|
13
16
|
@resolvers = {}
|
14
17
|
@cache = {}
|
15
|
-
@parent = parent
|
18
|
+
@parent = parent || Container
|
16
19
|
end
|
17
20
|
|
18
21
|
def register(name, object, options={})
|
data/lib/ioc/version.rb
CHANGED
data/spec/ioc_spec.rb
CHANGED