hypo 0.10.0 → 0.11.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: 616f20c6f5918ef12b8f4e9581a7bb9fc4d914f3b3f1792be6f10b26b16f6e9c
4
- data.tar.gz: 99a09c150f54245ed18008ec71d5855a4e04528eb1ddff8d590d2ee09dce8230
3
+ metadata.gz: cee4fc28f6e5b3ffd83bc7ac7bd9c5a9caddf7dff48c95ea9a05f566a7f38f5f
4
+ data.tar.gz: f2f785397ce4531f734e3d1a2feef70d1f65cc83e7dc942288cb7e93fe13d9b9
5
5
  SHA512:
6
- metadata.gz: e8ad659d399c93a45734d62b5635bdf8593c79d9a76352241332a6e2087ba09f2dcaae41b5c3e2b94f1584f728d66fa10141cfd64d8a8e1ad13db69035e69a28
7
- data.tar.gz: 7f4100718ca23c6145a5998ccb7668eef46035730db5a8c20448f59c2ed8120ff2db87464bf3caa4badfba617d42d949da0cd9c934f2bec3905cc58a7ca8695c
6
+ metadata.gz: 350d2722d85aceab3a93d7bf20cdcba31277fd758dde965dfeffbadff4c28b434190011665d7df08c7331b5e81c3c22adec7a7d47bd4d8a13a4748030cb9bf67
7
+ data.tar.gz: 86d9f71bf6f0837b4a49245b7d98ad10afbee3ebac6bf6382a5b75f8f66bc93c20a3a0d795fea9ebcd7f7046b99af3e4fa5518b9942a7f3a69e1b040d29f12e8
@@ -1,4 +1,5 @@
1
1
  require 'hypo/container_error'
2
+ require 'hypo/missing_component_error'
2
3
  require 'hypo/component'
3
4
  require 'hypo/instance'
4
5
  require 'hypo/lifetime/transient'
@@ -52,7 +53,7 @@ module Hypo
52
53
  if [:attrs, :attributes].include? name
53
54
  else
54
55
  unless @components.key?(name)
55
- raise ContainerError, "Component with name \"#{name}\" is not registered"
56
+ raise MissingComponentError.new(name)
56
57
  end
57
58
 
58
59
  @components[name].instance(attrs)
@@ -64,5 +65,9 @@ module Hypo
64
65
 
65
66
  self
66
67
  end
68
+
69
+ def show(component_name)
70
+ @components[component_name]
71
+ end
67
72
  end
68
73
  end
@@ -0,0 +1,12 @@
1
+ module Hypo
2
+ class MissingComponentError < ContainerError
3
+ attr_reader :component_name
4
+
5
+ def initialize(component_name)
6
+ message = "Component with name \"#{component_name}\" is not registered"
7
+ super(message)
8
+
9
+ @component_name = component_name
10
+ end
11
+ end
12
+ end
@@ -7,11 +7,13 @@ module Hypo
7
7
  end
8
8
 
9
9
  def purge
10
- @instances.each_value do |instance|
11
- instance.finalize if instance.respond_to? :finalize
10
+ begin
11
+ @instances.each_value do |instance|
12
+ instance.finalize if instance.respond_to? :finalize
13
+ end
14
+ ensure
15
+ @instances = Hash.new
12
16
  end
13
-
14
- @instances = Hash.new
15
17
  end
16
18
  end
17
19
  end
@@ -1,3 +1,3 @@
1
1
  module Hypo
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kalinkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-03 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ files:
78
78
  - lib/hypo/lifetime/singleton.rb
79
79
  - lib/hypo/lifetime/transient.rb
80
80
  - lib/hypo/lifetime_friendly.rb
81
+ - lib/hypo/missing_component_error.rb
81
82
  - lib/hypo/scope.rb
82
83
  - lib/hypo/scope_friendly.rb
83
84
  - lib/hypo/version.rb
@@ -101,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.7.7
105
+ rubygems_version: 3.0.6
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Hypo is sinless general purpose IoC container