hypo 0.8.3 → 0.8.4

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: 2ec1ae4a5a64bc063f724ebdd5ccb42b34297093
4
- data.tar.gz: ca1eb097353af419909214c72c7bd40aaadbbc34
3
+ metadata.gz: fd560fba4f09760c2f3ee4bf31f4b1f5402d3b01
4
+ data.tar.gz: 933cdf609ead65b7e544d0d95e53ce9c6f7bd36c
5
5
  SHA512:
6
- metadata.gz: 0eede098f99190deb1ecf72842a005915cd680a1ad7213076f80613940c9895b802aa981f5526758b22f9f5e6e404da663dcabc031c30e0516801ff3a9b273b3
7
- data.tar.gz: 9c878248fc321e02b6b33d8d764c19fdff8a4d79fa024e5e0ac48f573a7a0c3a16a10ab929482284bcef691ca9bf92e2fb3b403fe2218824c8f2e6d1d5d6f03f
6
+ metadata.gz: 707c9606de4cf20ab52b3dda040186efea9accefa83d519b1c1702582f6f27f2b7667cc913310b92fadac5e87dcf272068f40ebf8aebe55a73330e3619f9f14c
7
+ data.tar.gz: a7c6965b37b398284c19afbbf9fd0ce37dc914d52555a6e357d5d2eaa1bceb04295b5868a1ff119df1556887a050eb362f70e2f03be9187447954d0bd418bb6a
@@ -7,7 +7,7 @@ require 'hypo/lifetime/scope'
7
7
 
8
8
  module Hypo
9
9
  class Container
10
- attr_reader :lifetimes
10
+ attr_reader :lifetimes, :components
11
11
 
12
12
  def initialize
13
13
  @components = {}
@@ -36,6 +36,10 @@ module Hypo
36
36
  end
37
37
 
38
38
  def register_instance(item, name)
39
+ if %w(attrs attributes).include? name
40
+ raise ContainerError, "Name \"#{name}\" is reserved by Hypo container please use another variant."
41
+ end
42
+
39
43
  @mutex.synchronize do
40
44
  instance = Instance.new(item, self, name)
41
45
  @components[name] = instance
@@ -45,11 +49,15 @@ module Hypo
45
49
  end
46
50
 
47
51
  def resolve(name)
48
- unless @components.key?(name)
49
- raise ContainerError, "Component with name \"#{name}\" is not registered"
50
- end
52
+ if %w(attrs attributes).include? name
53
+ {}
54
+ else
55
+ unless @components.key?(name)
56
+ raise ContainerError, "Component with name \"#{name}\" is not registered"
57
+ end
51
58
 
52
- @components[name].instance
59
+ @components[name].instance
60
+ end
53
61
  end
54
62
 
55
63
  def add_lifetime(lifetime, name)
@@ -1,3 +1,3 @@
1
1
  module Hypo
2
- VERSION = '0.8.3'
2
+ VERSION = '0.8.4'
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.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kalinkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2018-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler