smart_initializer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +31 -26
- data/README.md +32 -4
- data/bin/rspec +1 -1
- data/gemfiles/with_external_deps.gemfile.lock +32 -29
- data/gemfiles/without_external_deps.gemfile.lock +16 -13
- data/lib/smart_core/initializer.rb +10 -4
- data/lib/smart_core/initializer/dsl.rb +1 -0
- data/lib/smart_core/initializer/{configurable_module.rb → functionality.rb} +15 -6
- data/lib/smart_core/initializer/instance_attribute_accessing.rb +51 -0
- data/lib/smart_core/initializer/version.rb +2 -1
- data/smart_initializer.gemspec +2 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5134f8c4bce2fc85b936310f04e67bf2d065205a29a34a53435eca06efba17f6
|
4
|
+
data.tar.gz: b4de1f15734ca61d124c944aeaca4f87fb6e5c1d5e4f8d92a3c7b63516ce708e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e1523cec71037f80aa99a6e36a5ffe06ca0da34d90f97e836dafdcd096cadceaebcb147499a636d1ce0f6868b0781e22ba21e0d589fb127cdfe41ff4882940
|
7
|
+
data.tar.gz: 4b9e5b9f6e3742cfa38fb969a7b3d0d2a5e85d49cd94a7f498d6302cdb1ac3910642772f5c9246a51fb4bf1ab4231af3c8a2a8328c4b343471a4e2563b3e9cd6
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.3.0] - 2020-07-11
|
5
|
+
### Added
|
6
|
+
- `extend_initialization_flow` alias method for `SmartCore::Initializer.ext_init`;
|
7
|
+
- Access methods to the instance attribute lists (`#__params`, `#__options__`, `#__attributes__`);
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
- Updated development dependencies;
|
11
|
+
|
4
12
|
## [0.2.0] - 2020-05-16
|
5
13
|
### Changed
|
6
14
|
- **Constructor**: disallow unknown option attributes;
|
data/Gemfile.lock
CHANGED
@@ -3,38 +3,39 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
smart_initializer (0.2.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
6
|
+
smart_engine (~> 0.7)
|
7
7
|
smart_types (~> 0.1.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.0.3)
|
12
|
+
activesupport (6.0.3.2)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (= 0.
|
20
|
-
rubocop-performance (= 1.
|
21
|
-
rubocop-rails (= 2.
|
18
|
+
armitage-rubocop (0.87.1.2)
|
19
|
+
rubocop (= 0.87.1)
|
20
|
+
rubocop-performance (= 1.7.0)
|
21
|
+
rubocop-rails (= 2.6.0)
|
22
22
|
rubocop-rake (= 0.5.1)
|
23
|
-
rubocop-rspec (= 1.
|
24
|
-
ast (2.4.
|
23
|
+
rubocop-rspec (= 1.42.0)
|
24
|
+
ast (2.4.1)
|
25
25
|
concurrent-ruby (1.1.6)
|
26
|
-
diff-lcs (1.
|
26
|
+
diff-lcs (1.4.4)
|
27
27
|
docile (1.3.2)
|
28
|
-
i18n (1.8.
|
28
|
+
i18n (1.8.3)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
minitest (5.14.1)
|
31
|
-
parallel (1.19.
|
32
|
-
parser (2.7.1.
|
33
|
-
ast (~> 2.4.
|
31
|
+
parallel (1.19.2)
|
32
|
+
parser (2.7.1.4)
|
33
|
+
ast (~> 2.4.1)
|
34
34
|
qonfig (0.24.1)
|
35
|
-
rack (2.2.
|
35
|
+
rack (2.2.3)
|
36
36
|
rainbow (3.0.0)
|
37
37
|
rake (13.0.1)
|
38
|
+
regexp_parser (1.7.1)
|
38
39
|
rexml (3.2.4)
|
39
40
|
rspec (3.9.0)
|
40
41
|
rspec-core (~> 3.9.0)
|
@@ -49,42 +50,46 @@ GEM
|
|
49
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
51
|
rspec-support (~> 3.9.0)
|
51
52
|
rspec-support (3.9.3)
|
52
|
-
rubocop (0.
|
53
|
+
rubocop (0.87.1)
|
53
54
|
parallel (~> 1.10)
|
54
|
-
parser (>= 2.7.
|
55
|
+
parser (>= 2.7.1.1)
|
55
56
|
rainbow (>= 2.2.2, < 4.0)
|
57
|
+
regexp_parser (>= 1.7)
|
56
58
|
rexml
|
59
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
57
60
|
ruby-progressbar (~> 1.7)
|
58
61
|
unicode-display_width (>= 1.4.0, < 2.0)
|
59
|
-
rubocop-
|
60
|
-
|
61
|
-
rubocop-
|
62
|
-
|
62
|
+
rubocop-ast (0.1.0)
|
63
|
+
parser (>= 2.7.0.1)
|
64
|
+
rubocop-performance (1.7.0)
|
65
|
+
rubocop (>= 0.82.0)
|
66
|
+
rubocop-rails (2.6.0)
|
67
|
+
activesupport (>= 4.2.0)
|
63
68
|
rack (>= 1.1)
|
64
|
-
rubocop (>= 0.
|
69
|
+
rubocop (>= 0.82.0)
|
65
70
|
rubocop-rake (0.5.1)
|
66
71
|
rubocop
|
67
|
-
rubocop-rspec (1.
|
68
|
-
rubocop (>= 0.
|
72
|
+
rubocop-rspec (1.42.0)
|
73
|
+
rubocop (>= 0.87.0)
|
69
74
|
ruby-progressbar (1.10.1)
|
70
75
|
simplecov (0.18.5)
|
71
76
|
docile (~> 1.1)
|
72
77
|
simplecov-html (~> 0.11)
|
73
78
|
simplecov-html (0.12.2)
|
74
|
-
smart_engine (0.
|
79
|
+
smart_engine (0.7.0)
|
75
80
|
smart_types (0.1.0)
|
76
81
|
smart_engine (~> 0.6)
|
77
82
|
thread_safe (0.3.6)
|
78
83
|
tzinfo (1.2.7)
|
79
84
|
thread_safe (~> 0.1)
|
80
85
|
unicode-display_width (1.7.0)
|
81
|
-
zeitwerk (2.3.
|
86
|
+
zeitwerk (2.3.1)
|
82
87
|
|
83
88
|
PLATFORMS
|
84
89
|
ruby
|
85
90
|
|
86
91
|
DEPENDENCIES
|
87
|
-
armitage-rubocop (~> 0.
|
92
|
+
armitage-rubocop (~> 0.87)
|
88
93
|
bundler (~> 2.1)
|
89
94
|
rake (~> 13.0)
|
90
95
|
rspec (~> 3.9)
|
data/README.md
CHANGED
@@ -12,11 +12,11 @@ gem 'smart_initializer'
|
|
12
12
|
```shell
|
13
13
|
bundle install
|
14
14
|
# --- or ---
|
15
|
-
gem install
|
15
|
+
gem install smart_initializer
|
16
16
|
```
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
require 'smart_core/
|
19
|
+
require 'smart_core/initializer'
|
20
20
|
```
|
21
21
|
|
22
22
|
---
|
@@ -24,7 +24,9 @@ require 'smart_core/types'
|
|
24
24
|
## Table of contents
|
25
25
|
|
26
26
|
- [Synopsis](#synopsis)
|
27
|
-
- [
|
27
|
+
- [Access to the instance attributes](#access-to-the-instance-attributes)
|
28
|
+
- [Configuration](#configuration)
|
29
|
+
- [Type aliasing](#type-aliasing)
|
28
30
|
- [Initialization extension](#initialization-extension)
|
29
31
|
- [Plugins](#plugins)
|
30
32
|
- [thy-types](#plugin-thy-types)
|
@@ -122,6 +124,31 @@ User.new(1, 'John', 'test123', role: :admin, metadata: {}, enabled: false)
|
|
122
124
|
|
123
125
|
---
|
124
126
|
|
127
|
+
## Access to the instance attributes
|
128
|
+
|
129
|
+
- `#__params__` - returns a list of initialized params;
|
130
|
+
- `#__options__` - returns a list of initialized options;
|
131
|
+
- `#__attributes__` - returns a list of merged params and options;
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
class User
|
135
|
+
include SmartCore::Initializer
|
136
|
+
|
137
|
+
param :first_name, 'string'
|
138
|
+
param :second_name, 'string'
|
139
|
+
option :age, 'numeric'
|
140
|
+
option :is_admin, 'boolean', default: true
|
141
|
+
end
|
142
|
+
|
143
|
+
user = User.new('Rustam', 'Ibragimov', age: 28)
|
144
|
+
|
145
|
+
user.__params__ # => { first_name: 'Rustam', second_name: 'Ibragimov' }
|
146
|
+
user.__options__ # => { age: 28, is_admin: true }
|
147
|
+
user.__attributes__ # => { first_name: 'Rustam', second_name: 'Ibragimov', age: 28, is_admin: true }
|
148
|
+
```
|
149
|
+
|
150
|
+
---
|
151
|
+
|
125
152
|
## Configuration
|
126
153
|
|
127
154
|
- based on `Qonfig` gem;
|
@@ -183,6 +210,7 @@ SmartCore::Initializer::TypeSystem::ThyTypes.type_aliases
|
|
183
210
|
- `ext_init(&block)`:
|
184
211
|
- you can define as many extensions as you want;
|
185
212
|
- extensions are invoked in the order they are defined;
|
213
|
+
- alias method: `extend_initialization_flow`;
|
186
214
|
|
187
215
|
```ruby
|
188
216
|
class User
|
@@ -269,7 +297,7 @@ bin/rspec -w
|
|
269
297
|
- without plugin tests:
|
270
298
|
|
271
299
|
```shell
|
272
|
-
bin/rspec -
|
300
|
+
bin/rspec -n
|
273
301
|
```
|
274
302
|
|
275
303
|
- help message:
|
data/bin/rspec
CHANGED
@@ -23,7 +23,7 @@ module SmartCoreInitializerRSpecRunner
|
|
23
23
|
run_with_plugin_tests!
|
24
24
|
end
|
25
25
|
|
26
|
-
opts.on('-
|
26
|
+
opts.on('-n', '--without-plugins', 'Run general tests (without plugin tests') do
|
27
27
|
run_without_plugin_tests!
|
28
28
|
end
|
29
29
|
end.parse!
|
@@ -1,41 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.2.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
6
|
+
smart_engine (~> 0.7)
|
7
7
|
smart_types (~> 0.1.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.0.3)
|
12
|
+
activesupport (6.0.3.2)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (= 0.
|
20
|
-
rubocop-performance (= 1.
|
21
|
-
rubocop-rails (= 2.
|
18
|
+
armitage-rubocop (0.87.1.2)
|
19
|
+
rubocop (= 0.87.1)
|
20
|
+
rubocop-performance (= 1.7.0)
|
21
|
+
rubocop-rails (= 2.6.0)
|
22
22
|
rubocop-rake (= 0.5.1)
|
23
|
-
rubocop-rspec (= 1.
|
24
|
-
ast (2.4.
|
23
|
+
rubocop-rspec (= 1.42.0)
|
24
|
+
ast (2.4.1)
|
25
25
|
concurrent-ruby (1.1.6)
|
26
26
|
diff-lcs (1.3)
|
27
27
|
docile (1.3.2)
|
28
|
-
i18n (1.8.
|
28
|
+
i18n (1.8.3)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
ast (~> 2.4.0)
|
30
|
+
minitest (5.14.1)
|
31
|
+
parallel (1.19.2)
|
32
|
+
parser (2.7.1.4)
|
33
|
+
ast (~> 2.4.1)
|
35
34
|
qonfig (0.24.1)
|
36
|
-
rack (2.2.
|
35
|
+
rack (2.2.3)
|
37
36
|
rainbow (3.0.0)
|
38
37
|
rake (13.0.1)
|
38
|
+
regexp_parser (1.7.1)
|
39
39
|
rexml (3.2.4)
|
40
40
|
rspec (3.9.0)
|
41
41
|
rspec-core (~> 3.9.0)
|
@@ -50,30 +50,33 @@ GEM
|
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
51
|
rspec-support (~> 3.9.0)
|
52
52
|
rspec-support (3.9.3)
|
53
|
-
rubocop (0.
|
54
|
-
jaro_winkler (~> 1.5.1)
|
53
|
+
rubocop (0.87.1)
|
55
54
|
parallel (~> 1.10)
|
56
|
-
parser (>= 2.7.
|
55
|
+
parser (>= 2.7.1.1)
|
57
56
|
rainbow (>= 2.2.2, < 4.0)
|
57
|
+
regexp_parser (>= 1.7)
|
58
58
|
rexml
|
59
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
59
60
|
ruby-progressbar (~> 1.7)
|
60
61
|
unicode-display_width (>= 1.4.0, < 2.0)
|
61
|
-
rubocop-
|
62
|
-
|
63
|
-
rubocop-
|
64
|
-
|
62
|
+
rubocop-ast (0.1.0)
|
63
|
+
parser (>= 2.7.0.1)
|
64
|
+
rubocop-performance (1.7.0)
|
65
|
+
rubocop (>= 0.82.0)
|
66
|
+
rubocop-rails (2.6.0)
|
67
|
+
activesupport (>= 4.2.0)
|
65
68
|
rack (>= 1.1)
|
66
|
-
rubocop (>= 0.
|
69
|
+
rubocop (>= 0.82.0)
|
67
70
|
rubocop-rake (0.5.1)
|
68
71
|
rubocop
|
69
|
-
rubocop-rspec (1.
|
70
|
-
rubocop (>= 0.
|
72
|
+
rubocop-rspec (1.42.0)
|
73
|
+
rubocop (>= 0.87.0)
|
71
74
|
ruby-progressbar (1.10.1)
|
72
75
|
simplecov (0.18.5)
|
73
76
|
docile (~> 1.1)
|
74
77
|
simplecov-html (~> 0.11)
|
75
78
|
simplecov-html (0.12.2)
|
76
|
-
smart_engine (0.
|
79
|
+
smart_engine (0.7.0)
|
77
80
|
smart_types (0.1.0)
|
78
81
|
smart_engine (~> 0.6)
|
79
82
|
thread_safe (0.3.6)
|
@@ -81,13 +84,13 @@ GEM
|
|
81
84
|
tzinfo (1.2.7)
|
82
85
|
thread_safe (~> 0.1)
|
83
86
|
unicode-display_width (1.7.0)
|
84
|
-
zeitwerk (2.3.
|
87
|
+
zeitwerk (2.3.1)
|
85
88
|
|
86
89
|
PLATFORMS
|
87
90
|
ruby
|
88
91
|
|
89
92
|
DEPENDENCIES
|
90
|
-
armitage-rubocop (~> 0.
|
93
|
+
armitage-rubocop (~> 0.87)
|
91
94
|
bundler (~> 2.1)
|
92
95
|
rake (~> 13.0)
|
93
96
|
rspec (~> 3.9)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.2.0)
|
5
5
|
qonfig (~> 0.24)
|
6
6
|
smart_engine (~> 0.6)
|
7
7
|
smart_types (~> 0.1.0)
|
@@ -9,15 +9,15 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.0.3)
|
12
|
+
activesupport (6.0.3.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (= 0.
|
20
|
-
rubocop-performance (= 1.
|
18
|
+
armitage-rubocop (0.85.0)
|
19
|
+
rubocop (= 0.85.0)
|
20
|
+
rubocop-performance (= 1.6.1)
|
21
21
|
rubocop-rails (= 2.5.2)
|
22
22
|
rubocop-rake (= 0.5.1)
|
23
23
|
rubocop-rspec (= 1.39.0)
|
@@ -25,17 +25,17 @@ GEM
|
|
25
25
|
concurrent-ruby (1.1.6)
|
26
26
|
diff-lcs (1.3)
|
27
27
|
docile (1.3.2)
|
28
|
-
i18n (1.8.
|
28
|
+
i18n (1.8.3)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
minitest (5.14.0)
|
30
|
+
minitest (5.14.1)
|
32
31
|
parallel (1.19.1)
|
33
|
-
parser (2.7.1.
|
32
|
+
parser (2.7.1.3)
|
34
33
|
ast (~> 2.4.0)
|
35
34
|
qonfig (0.24.1)
|
36
35
|
rack (2.2.2)
|
37
36
|
rainbow (3.0.0)
|
38
37
|
rake (13.0.1)
|
38
|
+
regexp_parser (1.7.1)
|
39
39
|
rexml (3.2.4)
|
40
40
|
rspec (3.9.0)
|
41
41
|
rspec-core (~> 3.9.0)
|
@@ -50,15 +50,18 @@ GEM
|
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
51
|
rspec-support (~> 3.9.0)
|
52
52
|
rspec-support (3.9.3)
|
53
|
-
rubocop (0.
|
54
|
-
jaro_winkler (~> 1.5.1)
|
53
|
+
rubocop (0.85.0)
|
55
54
|
parallel (~> 1.10)
|
56
55
|
parser (>= 2.7.0.1)
|
57
56
|
rainbow (>= 2.2.2, < 4.0)
|
57
|
+
regexp_parser (>= 1.7)
|
58
58
|
rexml
|
59
|
+
rubocop-ast (>= 0.0.3)
|
59
60
|
ruby-progressbar (~> 1.7)
|
60
61
|
unicode-display_width (>= 1.4.0, < 2.0)
|
61
|
-
rubocop-
|
62
|
+
rubocop-ast (0.0.3)
|
63
|
+
parser (>= 2.7.0.1)
|
64
|
+
rubocop-performance (1.6.1)
|
62
65
|
rubocop (>= 0.71.0)
|
63
66
|
rubocop-rails (2.5.2)
|
64
67
|
activesupport
|
@@ -86,7 +89,7 @@ PLATFORMS
|
|
86
89
|
ruby
|
87
90
|
|
88
91
|
DEPENDENCIES
|
89
|
-
armitage-rubocop (~> 0.
|
92
|
+
armitage-rubocop (~> 0.85)
|
90
93
|
bundler (~> 2.1)
|
91
94
|
rake (~> 13.0)
|
92
95
|
rspec (~> 3.9)
|
@@ -15,12 +15,16 @@ module SmartCore
|
|
15
15
|
require_relative 'initializer/plugins'
|
16
16
|
require_relative 'initializer/settings'
|
17
17
|
require_relative 'initializer/configuration'
|
18
|
-
require_relative 'initializer/configurable_module'
|
19
18
|
require_relative 'initializer/type_system'
|
20
19
|
require_relative 'initializer/attribute'
|
21
20
|
require_relative 'initializer/extensions'
|
22
21
|
require_relative 'initializer/constructor'
|
23
22
|
require_relative 'initializer/dsl'
|
23
|
+
require_relative 'initializer/instance_attribute_accessing'
|
24
|
+
require_relative 'initializer/functionality'
|
25
|
+
|
26
|
+
# @since 0.3.0
|
27
|
+
include SmartCore::Initializer::InstanceAttributeAccessing
|
24
28
|
|
25
29
|
class << self
|
26
30
|
# @param base_klass [Class]
|
@@ -28,8 +32,9 @@ module SmartCore
|
|
28
32
|
#
|
29
33
|
# @api private
|
30
34
|
# @since 0.1.0
|
35
|
+
# @version 0.3.0
|
31
36
|
def included(base_klass)
|
32
|
-
|
37
|
+
::SmartCore::Initializer::Functionality.seed_to(base_klass)
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
@@ -46,9 +51,10 @@ module SmartCore
|
|
46
51
|
#
|
47
52
|
# @api public
|
48
53
|
# @since 0.1.0
|
54
|
+
# @version 0.3.0
|
49
55
|
# rubocop:disable Naming/MethodName
|
50
|
-
def Initializer(type_system: SmartCore::Initializer::
|
51
|
-
SmartCore::Initializer::
|
56
|
+
def Initializer(type_system: SmartCore::Initializer::Functionality::INITIAL_TYPE_SYSTEM)
|
57
|
+
SmartCore::Initializer::Functionality.includable_module(type_system: type_system)
|
52
58
|
end
|
53
59
|
# rubocop:enable Naming/MethodName
|
54
60
|
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# @api private
|
4
|
-
# @since 0.
|
5
|
-
module SmartCore::Initializer::
|
4
|
+
# @since 0.3.0
|
5
|
+
module SmartCore::Initializer::Functionality
|
6
6
|
# @return [NilClass]
|
7
7
|
#
|
8
8
|
# @api private
|
9
|
-
# @since 0.
|
9
|
+
# @since 0.3.0
|
10
10
|
INITIAL_TYPE_SYSTEM = nil
|
11
11
|
|
12
12
|
class << self
|
13
|
-
# @
|
13
|
+
# @option type_system [String, Symbol, NilClass]
|
14
14
|
# @return [Module]
|
15
15
|
#
|
16
16
|
# @api private
|
17
|
-
# @since 0.
|
18
|
-
def
|
17
|
+
# @since 0.3.0
|
18
|
+
def includable_module(type_system: INITIAL_TYPE_SYSTEM)
|
19
19
|
Module.new.tap do |extension|
|
20
20
|
extension.singleton_class.define_method(:included) do |base_klass|
|
21
21
|
base_klass.include(::SmartCore::Initializer)
|
@@ -23,5 +23,14 @@ module SmartCore::Initializer::ConfigurableModule
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
# @param base_klass [Class]
|
28
|
+
# @return [void]
|
29
|
+
#
|
30
|
+
# @api private
|
31
|
+
# @since 0.3.0
|
32
|
+
def seed_to(base_klass)
|
33
|
+
base_klass.extend(SmartCore::Initializer::DSL)
|
34
|
+
end
|
26
35
|
end
|
27
36
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api private
|
4
|
+
# @since 0.3.0
|
5
|
+
module SmartCore::Initializer::InstanceAttributeAccessing
|
6
|
+
# @return [Hash<Symbol,Any>]
|
7
|
+
#
|
8
|
+
# @api public
|
9
|
+
# @since 0.3.0
|
10
|
+
def __params__
|
11
|
+
__collect_params__
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Hash<Symbol,Any>]
|
15
|
+
#
|
16
|
+
# @api public
|
17
|
+
# @since 0.3.0
|
18
|
+
def __options__
|
19
|
+
__collect_options__
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Hash<Symbol,Any>]
|
23
|
+
#
|
24
|
+
# @api public
|
25
|
+
# @since 0.3.0
|
26
|
+
def __attributes__
|
27
|
+
__collect_params__.merge(__collect_options__)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# @return [Hash<Symbol,Any>]
|
33
|
+
#
|
34
|
+
# @api private
|
35
|
+
# @since 0.3.0
|
36
|
+
def __collect_params__
|
37
|
+
self.class.__params__.each_with_object({}) do |param, memo|
|
38
|
+
memo[param.name] = instance_variable_get("@#{param.name}")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [Hash<Symbol,Any>]
|
43
|
+
#
|
44
|
+
# @api private
|
45
|
+
# @since 0.3.0
|
46
|
+
def __collect_options__
|
47
|
+
self.class.__options__.each_with_object({}) do |option, memo|
|
48
|
+
memo[option.name] = instance_variable_get("@#{option.name}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/smart_initializer.gemspec
CHANGED
@@ -30,13 +30,13 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
|
-
spec.add_dependency 'smart_engine', '~> 0.
|
33
|
+
spec.add_dependency 'smart_engine', '~> 0.7'
|
34
34
|
spec.add_dependency 'smart_types', '~> 0.1.0'
|
35
35
|
spec.add_dependency 'qonfig', '~> 0.24'
|
36
36
|
|
37
37
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
40
|
-
spec.add_development_dependency 'armitage-rubocop', '~> 0.
|
40
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 0.87'
|
41
41
|
spec.add_development_dependency 'simplecov', '~> 0.18'
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_initializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smart_engine
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: smart_types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
103
|
+
version: '0.87'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
110
|
+
version: '0.87'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,7 +156,6 @@ files:
|
|
156
156
|
- lib/smart_core/initializer/attribute/finalizer/instance_method.rb
|
157
157
|
- lib/smart_core/initializer/attribute/list.rb
|
158
158
|
- lib/smart_core/initializer/attribute/parameters.rb
|
159
|
-
- lib/smart_core/initializer/configurable_module.rb
|
160
159
|
- lib/smart_core/initializer/configuration.rb
|
161
160
|
- lib/smart_core/initializer/constructor.rb
|
162
161
|
- lib/smart_core/initializer/constructor/definer.rb
|
@@ -167,6 +166,8 @@ files:
|
|
167
166
|
- lib/smart_core/initializer/extensions/abstract.rb
|
168
167
|
- lib/smart_core/initializer/extensions/ext_init.rb
|
169
168
|
- lib/smart_core/initializer/extensions/list.rb
|
169
|
+
- lib/smart_core/initializer/functionality.rb
|
170
|
+
- lib/smart_core/initializer/instance_attribute_accessing.rb
|
170
171
|
- lib/smart_core/initializer/plugins.rb
|
171
172
|
- lib/smart_core/initializer/plugins/abstract.rb
|
172
173
|
- lib/smart_core/initializer/plugins/access_mixin.rb
|