smart_ioc 0.2.1 → 0.2.2

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: 021a4becce26b0f20606a344c32777b48518c040
4
- data.tar.gz: f8cca4742cb9eae0a2eab939d7d0995851d9591e
3
+ metadata.gz: aeab800e2e18812c2d25fe456a4e9d434e3ca63c
4
+ data.tar.gz: a7a3247fe3174be4e45453af569bc631cb81eae6
5
5
  SHA512:
6
- metadata.gz: 9229b37895dc31dac6bc7889cef8b310a9f2cb747a0539d3391e9b6a6bb621fcd0f9e0266e464ffb1b16a1f349895b88fd7c563f4db78b8a5adaa6d7af35d9b7
7
- data.tar.gz: b29c3eb963a5a0e27d7a5ff2c86fcb86f33286ea92d5b9d9e94f73b213dc0f5505848a2ced3be321debaf334ee56472dcaa8cd313591464bd38aed424d59b78f
6
+ metadata.gz: 317128788531e93c88f58e866322151c79f8af17e229f28ef1e8b641152e91d813ffc2d44d2fb80dbf986c65ec658059245472b1343d57e3ba32238e76c77752
7
+ data.tar.gz: e07b6743d555dc82ed0a1b18252771747f91f463adfce06b57dc91f32dcf7522851bd4f772a32df32bd7f1f188fadfa639c1c85828c219d2eba6dd8d0c110b83
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_ioc (0.2.1)
4
+ smart_ioc (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -48,4 +48,4 @@ DEPENDENCIES
48
48
  smart_ioc!
49
49
 
50
50
  BUNDLED WITH
51
- 1.15.1
51
+ 1.15.4
@@ -11,7 +11,8 @@
11
11
  # }
12
12
  # }
13
13
  class SmartIoC::BeanLocations
14
- @data = {}
14
+ @data = {}
15
+ @paths = {}
15
16
 
16
17
  class << self
17
18
  # @param package_name [Symbol] bean package name (ex: :repository)
@@ -23,12 +24,18 @@ class SmartIoC::BeanLocations
23
24
  @data[package_name] ||= {}
24
25
  package_beans = @data[package_name]
25
26
 
27
+ @paths[bean_path] = bean
28
+
26
29
  package_beans[bean] ||= []
27
30
  package_beans[bean].push(bean_path)
28
31
 
29
32
  nil
30
33
  end
31
34
 
35
+ def get_bean_by_path(path)
36
+ @paths[path]
37
+ end
38
+
32
39
  # @param bean [Symbol] bean name (ex: :users_repository)
33
40
  # @return Hash[Array[String]] hash of bean definitions from all packages
34
41
  def get_bean_locations(bean)
@@ -1,3 +1,3 @@
1
1
  module SmartIoC
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe SmartIoC::BeanLocations do
4
+ before :all do
5
+ SmartIoC.clear
6
+ end
7
+
8
+ it {
9
+ path = '/app/test_path'
10
+ SmartIoC::BeanLocations.add_bean(:test, :test_bean, path)
11
+
12
+ expect(SmartIoC::BeanLocations.get_bean_by_path(path)).to eq(:test_bean)
13
+ }
14
+ end
@@ -13,8 +13,8 @@ describe SmartIoC::BeanLocator do
13
13
  locations = SmartIoC::BeanLocations.get_bean_locations(:repository)
14
14
 
15
15
  expect(locations[:test].size).to eq(3)
16
- expect(locations[:test][0]).to match(/example\/admins\/repository\/admins_repository.rb/)
17
- expect(locations[:test][1]).to match(/example\/admins\/repository\/test\/admins_repository.rb/)
16
+ expect(locations[:test][0]).to match(/example\/admins\/repository\/test\/admins_repository.rb/)
17
+ expect(locations[:test][1]).to match(/example\/admins\/repository\/admins_repository.rb/)
18
18
  expect(locations[:test][2]).to match(/example\/users\/repository\/users_repository.rb/)
19
19
  }
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,6 +95,7 @@ files:
95
95
  - spec/smart_ioc/bean_definition_spec.rb
96
96
  - spec/smart_ioc/bean_factory_spec.rb
97
97
  - spec/smart_ioc/bean_file_loader_spec.rb
98
+ - spec/smart_ioc/bean_locations_spec.rb
98
99
  - spec/smart_ioc/bean_locator_spec.rb
99
100
  - spec/smart_ioc/container_spec.rb
100
101
  - spec/smart_ioc/example/admins/repository/admins_dao.rb
@@ -139,6 +140,7 @@ test_files:
139
140
  - spec/smart_ioc/bean_definition_spec.rb
140
141
  - spec/smart_ioc/bean_factory_spec.rb
141
142
  - spec/smart_ioc/bean_file_loader_spec.rb
143
+ - spec/smart_ioc/bean_locations_spec.rb
142
144
  - spec/smart_ioc/bean_locator_spec.rb
143
145
  - spec/smart_ioc/container_spec.rb
144
146
  - spec/smart_ioc/example/admins/repository/admins_dao.rb