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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f9b4ded444c163bcc5b3347c651f12f5d9911f4
4
- data.tar.gz: 8ff0dc2532edf5c9a02f16e977384203aa343b38
3
+ metadata.gz: 5cb8ce6e01a3cca2df893843489987645885b6f3
4
+ data.tar.gz: 023f597d968c21b40dc1db1237c377c17326263b
5
5
  SHA512:
6
- metadata.gz: b447c98ba611bd3d48ae34a0e6f40a7375557752d93439c4619f1bafbb0368ac1a5fbc5ec56d9fe669db1b1014d5d11e769c2f3b1cd6e67e86e50c45d905f980
7
- data.tar.gz: 826f0ad29d6b2432ce4057539b4ad13af6466710b1b8f7cde86338b6b8c4e70073884f6e64dce234f77c6f2ba132119b195e7dc2b78855f72e86a4b4175ab4d6
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(*installers)
5
- [*installers].inject(new) do |container, installer|
6
- installer.install(container)
7
- container
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=Container, resolver_factory=ResolverFactory)
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
@@ -1,3 +1,3 @@
1
1
  module IOC
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/spec/ioc_spec.rb CHANGED
@@ -202,7 +202,7 @@ describe IOC::Container do
202
202
  end
203
203
  end
204
204
 
205
- container = IOC::Container.install(installer_class)
205
+ container = IOC::Container.install(:installers => installer_class)
206
206
  container.resolve(:myobj).must_equal('I was resolved')
207
207
  end
208
208
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Lott