smart_ioc 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de564b00fb136146fd0f4d4182fe58f7cd9f1bd56c01a23ccc7aca185befc7e8
4
- data.tar.gz: d9cb0e43111c988b77d8454fc3b7f45cf4aa2109a76839f2da17135eaef57e52
3
+ metadata.gz: 01e3fac1f32289e170915d3251e88d937f970f6396ef7d6a8c7b2163696001f2
4
+ data.tar.gz: 15f36e9c706c0cfdb59c86e8f40cf1106361346b0f0def709f9618b3821cc865
5
5
  SHA512:
6
- metadata.gz: 4a5a9d63019c4a0fabda18691014bbaf510ef703e1592a00a97bae1a582f523cfa8328c826a331764602664346771033ef3bf2d49bb3b27a98d9830e2f465f98
7
- data.tar.gz: 9ae3b6e48602c173ca5ef0544c587c156d10e89616bbcdfb53ae293c98a4b6d047a3d2e01712b072ecfdc6bd519391735b20b12425ce513c9ebd6abb8d87d118
6
+ metadata.gz: 11fae8af77f705ecdbd3a6039dd5c148abd28fc5ef8e584644179f76f23f1c061f4dc4c049a593f308037ef0e1f033c0cd6641e3d761447e51a97c6ea3699efd
7
+ data.tar.gz: 82ea8d86866fe7eace9a1db47da5fd87457cd499425387aa977d086ac514525463902e8f4f8261ae91c4ba9e35ddc0b4f25761303552e35c63c05edd34d2ba7a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_ioc (0.3.5)
4
+ smart_ioc (0.3.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -9,11 +9,15 @@ def bean(bean_name, &proc)
9
9
  klass.instance_variable_set(:@anonymous_bean, true)
10
10
  klass.instance_exec(&proc)
11
11
 
12
+ file_path = caller[0].split(':').first
13
+ package = SmartIoC::BeanLocations.get_bean_package(file_path)
14
+
12
15
  klass.instance_exec do
13
16
  bean(
14
17
  bean_name,
18
+ file_path: file_path,
15
19
  scope: instance_variable_get(:@scope) || nil,
16
- package: instance_variable_get(:@package) || nil,
20
+ package: instance_variable_get(:@package) || package,
17
21
  instance: instance_variable_get(:@instance) || false,
18
22
  factory_method: instance_variable_get(:@factory_method) || nil,
19
23
  context: instance_variable_get(:@context) || nil,
@@ -21,12 +21,14 @@ class SmartIoC::BeanDefinitionsStorage
21
21
 
22
22
  if existing_bd
23
23
  error_msg =
24
- %Q(Not able to add bean to definitions storage.
24
+ %Q(Unable to add bean to definitions storage.
25
25
  Bean definition already exists.
26
+
26
27
  New bean details:
27
- #{bean_definition.inspect}
28
+ #{bean_definition.inspect}
29
+
28
30
  Existing bean details:
29
- #{existing_bd.inspect})
31
+ #{existing_bd.inspect})
30
32
 
31
33
  raise ArgumentError, error_msg
32
34
  end
@@ -120,8 +120,6 @@ class SmartIoC::BeanFactory
120
120
  end
121
121
 
122
122
  if smart_bds.size > 1
123
- require 'byebug'
124
- debugger
125
123
  raise ArgumentError.new(
126
124
  %Q(Unable to autodetect bean :#{bean}#{parent_bean_name ? " for bean :#{parent_bean_name}" : ''}.
127
125
  Several definitions were found:\n
@@ -64,8 +64,8 @@ module SmartIoC::Iocify
64
64
  # @param context [Symbol] set bean context (ex: :test)
65
65
  # @param after_init [Symbol] name of bean method that will be called after bean initialization (ex: :test)
66
66
  # @return nil
67
- def bean(bean_name, scope: nil, package: nil, instance: true, factory_method: nil, context: nil, after_init: nil)
68
- file_path = caller[0].split(':').first
67
+ def bean(bean_name, scope: nil, package: nil, instance: true, factory_method: nil, context: nil, after_init: nil, file_path: nil)
68
+ file_path ||= caller[0].split(':').first
69
69
  package ||= SmartIoC::BeanLocations.get_bean_package(file_path)
70
70
  context ||= SmartIoC::Container::DEFAULT_CONTEXT
71
71
  bean_definition = SmartIoC.get_bean_definition(bean_name, package, context)
@@ -1,3 +1,3 @@
1
1
  module SmartIoC
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -1,7 +1,5 @@
1
- class AdminsDAO
2
- include SmartIoC::Iocify
3
-
4
- bean :dao, instance: false, after_init: :setup
1
+ bean :dao do
2
+ after_init :setup
5
3
 
6
4
  inject :config
7
5
 
@@ -1,13 +1,7 @@
1
- class AdminsRepository
2
- include SmartIoC::Iocify
3
-
4
- bean :repository
5
-
1
+ bean :repository do
6
2
  inject :dao
7
3
  inject :users_creator
8
4
 
9
- public :users_creator
10
-
11
5
  def put(user)
12
6
  dao.insert(user)
13
7
  end
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.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-15 00:00:00.000000000 Z
11
+ date: 2020-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler