dry-system 0.8.0 → 0.8.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: e2b3c4fc9aed09b6920d6c285df0407e8cb506f2
4
- data.tar.gz: 5034704e210f09cae4f54e7ddb67371fc31bba31
3
+ metadata.gz: a18b1a854bc129ce0971540b70db051a98d7af4f
4
+ data.tar.gz: 3028860d178d68633123d23fd3900508cd6defb2
5
5
  SHA512:
6
- metadata.gz: cff3f64d9fe0762d3e59893caf4f8e7f85da8b17ed40f7b6970a4518950e1ab60ad99531ae20383c10915ed296895df21a149f872a3d8dc0da214f7ed5caeabc
7
- data.tar.gz: 51092e33d452c9008ddba0a384a989420287c9fce19f730b85f5903a99f7da5f4b4aa626ee4c83d693434135f8793b33aea7df037682b408f8fcfe1b751a3e00
6
+ metadata.gz: ccc8a1a34791ffaa7d4e345d7ca734f48a017d3ea85e7ccda787ea6ffecc2cf71542c84aaf697bbf66447e964a8a598f8e1ad766c4ea4750c1340edd18c8ac8c
7
+ data.tar.gz: 6a8566bac53d9feab8655d04022150c70a8d263e294ce4df82a8023430bd975cae426b74c444c442076961f7804f977bdfec2a3512834c9180b37aa4cf253728
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.8.0 - 2017-10-17
2
+
3
+ ### Fixed
4
+
5
+ * Aliasing an external component works correctly (solnic)
6
+ * Manually calling `:init` will also finalize a component (solnic)
7
+
8
+ [Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-system/compare/v0.8.0...v0.8.1)
9
+
1
10
  # 0.8.0 - 2017-10-16
2
11
 
3
12
  ### Added
@@ -60,7 +60,7 @@ module Dry
60
60
  def init(name_or_component)
61
61
  with_component(name_or_component) do |component|
62
62
  call(component) do
63
- component.init
63
+ component.init.finalize
64
64
  yield if block_given?
65
65
  end
66
66
 
@@ -207,6 +207,15 @@ module Dry
207
207
  self
208
208
  end
209
209
 
210
+ # Return a new instance with updated name and options
211
+ #
212
+ # @return [Dry::Struct]
213
+ #
214
+ # @api private
215
+ def new(identifier, new_options = EMPTY_HASH)
216
+ self.class.new(identifier, options.merge(new_options))
217
+ end
218
+
210
219
  # Return a new instance with updated options
211
220
  #
212
221
  # @return [Dry::Struct]
@@ -231,7 +231,7 @@ module Dry
231
231
  # @api private
232
232
  def boot_external(identifier, from:, key: nil, namespace: nil, &block)
233
233
  component = System.providers[from].component(
234
- key || identifier, key: identifier, namespace: namespace, finalize: block, container: self
234
+ identifier, key: key, namespace: namespace, finalize: block, container: self
235
235
  )
236
236
 
237
237
  booter.register_component(component)
@@ -240,8 +240,8 @@ module Dry
240
240
  end
241
241
 
242
242
  # @api private
243
- def boot_local(name, namespace: nil, &block)
244
- component = Components::Bootable.new(name, container: self, namespace: namespace, &block)
243
+ def boot_local(identifier, namespace: nil, &block)
244
+ component = Components::Bootable.new(identifier, container: self, namespace: namespace, &block)
245
245
 
246
246
  booter.register_component(component)
247
247
 
@@ -33,7 +33,8 @@ module Dry
33
33
  end
34
34
 
35
35
  def component(name, options = {})
36
- components.fetch(name).with(options)
36
+ identifier = options[:key] || name
37
+ components.fetch(identifier).new(name, options)
37
38
  end
38
39
 
39
40
  def load_components
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module System
3
- VERSION = '0.8.0'.freeze
3
+ VERSION = '0.8.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-system
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-16 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inflecto