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 +4 -4
- data/lib/hypo/container.rb +6 -1
- data/lib/hypo/missing_component_error.rb +12 -0
- data/lib/hypo/scope.rb +6 -4
- data/lib/hypo/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cee4fc28f6e5b3ffd83bc7ac7bd9c5a9caddf7dff48c95ea9a05f566a7f38f5f
|
4
|
+
data.tar.gz: f2f785397ce4531f734e3d1a2feef70d1f65cc83e7dc942288cb7e93fe13d9b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 350d2722d85aceab3a93d7bf20cdcba31277fd758dde965dfeffbadff4c28b434190011665d7df08c7331b5e81c3c22adec7a7d47bd4d8a13a4748030cb9bf67
|
7
|
+
data.tar.gz: 86d9f71bf6f0837b4a49245b7d98ad10afbee3ebac6bf6382a5b75f8f66bc93c20a3a0d795fea9ebcd7f7046b99af3e4fa5518b9942a7f3a69e1b040d29f12e8
|
data/lib/hypo/container.rb
CHANGED
@@ -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
|
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
|
data/lib/hypo/scope.rb
CHANGED
@@ -7,11 +7,13 @@ module Hypo
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def purge
|
10
|
-
|
11
|
-
|
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
|
data/lib/hypo/version.rb
CHANGED
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.
|
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:
|
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
|
-
|
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
|