smart_initializer 0.9.0 → 0.10.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 +12 -0
- data/Gemfile.lock +49 -53
- data/README.md +5 -0
- data/gemfiles/with_external_deps.gemfile.lock +51 -54
- data/gemfiles/without_external_deps.gemfile.lock +51 -52
- data/lib/smart_core/initializer/attribute/factory/base.rb +12 -3
- data/lib/smart_core/initializer/attribute/list.rb +19 -20
- data/lib/smart_core/initializer/constructor/definer.rb +13 -19
- data/lib/smart_core/initializer/dsl.rb +4 -3
- data/lib/smart_core/initializer/extensions/list.rb +11 -14
- data/lib/smart_core/initializer/plugins/abstract.rb +3 -1
- data/lib/smart_core/initializer/plugins/registry.rb +13 -14
- data/lib/smart_core/initializer/plugins/registry_interface.rb +11 -19
- data/lib/smart_core/initializer/settings/auto_cast.rb +5 -11
- data/lib/smart_core/initializer/settings/base.rb +5 -13
- data/lib/smart_core/initializer/settings/strict_options.rb +5 -11
- data/lib/smart_core/initializer/settings/type_system.rb +7 -16
- data/lib/smart_core/initializer/type_system/interop/aliasing/alias_list.rb +18 -21
- data/lib/smart_core/initializer/type_system/registry.rb +22 -24
- data/lib/smart_core/initializer/type_system/registry_interface.rb +15 -22
- data/lib/smart_core/initializer/version.rb +2 -2
- data/smart_initializer.gemspec +5 -5
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f071c193e7dba7c0e30acf950159bc97f41933bbb7a6cb2e04838b1de474c0d7
|
4
|
+
data.tar.gz: 5867c7ffc8181767a85ad0d609ca3a1d9c6697e4eb0abaa3e9997341cc237165
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e964ae02c95f010da48499b508c8f5bd755aa0b44165fe173dcdd80385f4c1006fc469ebf5568303f5f47e58cb514c0f4a1e10b5062b2db5b953f57b3bda8549
|
7
|
+
data.tar.gz: 8907288d0ff34f3f76d6bf5291cce236413ef998a944966f90074e871126809b98c7ed16890ecf84a338da22096e108a6d40d84f640d602628ae97a5cc9656fd
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.10.0] - 2022-10-04
|
5
|
+
### Changed
|
6
|
+
- `SmartCore::Engine::ReadWriteLock` is used instead `SmartCore::Engine::Lock` in order to decrease the count of RubyVM's context switching and useless Mutexes usage;
|
7
|
+
- reduced `KeyError`-exception flow use cases in some cases inside the framework internals (in order to reduce object allocations under the hood);
|
8
|
+
- bumped development dependencies;
|
9
|
+
- bumped core dependencies (in order to use `ReadWiteLock` (and actualize available inner-framework features);
|
10
|
+
|
11
|
+
## [0.9.1] - 2022-03-06
|
12
|
+
### Fixed
|
13
|
+
- `finalize` now accepts lambdas with arity `-2`. For example `->(a, *b) {}` or `:freeze.to_proc`
|
14
|
+
which in `Ruby >= 3` returns lambda with arity equal to `-2`.
|
15
|
+
|
4
16
|
## [0.9.0] - 2021-12-19
|
5
17
|
### Changed
|
6
18
|
- `:finalize` block is not invoked on the `option` with `optional: true` flag;
|
data/Gemfile.lock
CHANGED
@@ -1,81 +1,80 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.10.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
7
|
-
smart_types (~> 0.
|
6
|
+
smart_engine (~> 0.16)
|
7
|
+
smart_types (~> 0.7)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (7.0.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
|
-
|
18
|
-
|
19
|
-
rubocop (= 1.
|
20
|
-
rubocop-
|
21
|
-
rubocop-rails (= 2.12.4)
|
17
|
+
armitage-rubocop (1.30.1.1)
|
18
|
+
rubocop (= 1.30.1)
|
19
|
+
rubocop-performance (= 1.14.2)
|
20
|
+
rubocop-rails (= 2.15.0)
|
22
21
|
rubocop-rake (= 0.6.0)
|
23
|
-
rubocop-rspec (= 2.
|
22
|
+
rubocop-rspec (= 2.11.1)
|
24
23
|
ast (2.4.2)
|
25
24
|
coderay (1.1.3)
|
26
|
-
concurrent-ruby (1.1.
|
27
|
-
diff-lcs (1.
|
25
|
+
concurrent-ruby (1.1.10)
|
26
|
+
diff-lcs (1.5.0)
|
28
27
|
docile (1.4.0)
|
29
|
-
i18n (1.
|
28
|
+
i18n (1.12.0)
|
30
29
|
concurrent-ruby (~> 1.0)
|
31
30
|
method_source (1.0.0)
|
32
|
-
minitest (5.
|
33
|
-
parallel (1.
|
34
|
-
parser (3.
|
31
|
+
minitest (5.16.3)
|
32
|
+
parallel (1.22.1)
|
33
|
+
parser (3.1.2.1)
|
35
34
|
ast (~> 2.4.1)
|
36
35
|
pry (0.14.1)
|
37
36
|
coderay (~> 1.1)
|
38
37
|
method_source (~> 1.0)
|
39
|
-
qonfig (0.
|
40
|
-
rack (
|
41
|
-
rainbow (3.
|
38
|
+
qonfig (0.28.0)
|
39
|
+
rack (3.0.0)
|
40
|
+
rainbow (3.1.1)
|
42
41
|
rake (13.0.6)
|
43
|
-
regexp_parser (2.
|
42
|
+
regexp_parser (2.6.0)
|
44
43
|
rexml (3.2.5)
|
45
|
-
rspec (3.
|
46
|
-
rspec-core (~> 3.
|
47
|
-
rspec-expectations (~> 3.
|
48
|
-
rspec-mocks (~> 3.
|
49
|
-
rspec-core (3.
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-expectations (3.
|
44
|
+
rspec (3.11.0)
|
45
|
+
rspec-core (~> 3.11.0)
|
46
|
+
rspec-expectations (~> 3.11.0)
|
47
|
+
rspec-mocks (~> 3.11.0)
|
48
|
+
rspec-core (3.11.0)
|
49
|
+
rspec-support (~> 3.11.0)
|
50
|
+
rspec-expectations (3.11.1)
|
52
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.11.0)
|
53
|
+
rspec-mocks (3.11.1)
|
55
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
-
rspec-support (~> 3.
|
57
|
-
rspec-support (3.
|
58
|
-
rubocop (1.
|
55
|
+
rspec-support (~> 3.11.0)
|
56
|
+
rspec-support (3.11.1)
|
57
|
+
rubocop (1.30.1)
|
59
58
|
parallel (~> 1.10)
|
60
|
-
parser (>= 3.
|
59
|
+
parser (>= 3.1.0.0)
|
61
60
|
rainbow (>= 2.2.2, < 4.0)
|
62
61
|
regexp_parser (>= 1.8, < 3.0)
|
63
|
-
rexml
|
64
|
-
rubocop-ast (>= 1.
|
62
|
+
rexml (>= 3.2.5, < 4.0)
|
63
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
65
64
|
ruby-progressbar (~> 1.7)
|
66
65
|
unicode-display_width (>= 1.4.0, < 3.0)
|
67
|
-
rubocop-ast (1.
|
68
|
-
parser (>= 3.
|
69
|
-
rubocop-performance (1.
|
66
|
+
rubocop-ast (1.21.0)
|
67
|
+
parser (>= 3.1.1.0)
|
68
|
+
rubocop-performance (1.14.2)
|
70
69
|
rubocop (>= 1.7.0, < 2.0)
|
71
70
|
rubocop-ast (>= 0.4.0)
|
72
|
-
rubocop-rails (2.
|
71
|
+
rubocop-rails (2.15.0)
|
73
72
|
activesupport (>= 4.2.0)
|
74
73
|
rack (>= 1.1)
|
75
74
|
rubocop (>= 1.7.0, < 2.0)
|
76
75
|
rubocop-rake (0.6.0)
|
77
76
|
rubocop (~> 1.0)
|
78
|
-
rubocop-rspec (2.
|
77
|
+
rubocop-rspec (2.11.1)
|
79
78
|
rubocop (~> 1.19)
|
80
79
|
ruby-progressbar (1.11.0)
|
81
80
|
simplecov (0.21.2)
|
@@ -83,28 +82,25 @@ GEM
|
|
83
82
|
simplecov-html (~> 0.11)
|
84
83
|
simplecov_json_formatter (~> 0.1)
|
85
84
|
simplecov-html (0.12.3)
|
86
|
-
simplecov_json_formatter (0.1.
|
87
|
-
smart_engine (0.
|
88
|
-
smart_types (0.7.
|
85
|
+
simplecov_json_formatter (0.1.4)
|
86
|
+
smart_engine (0.16.0)
|
87
|
+
smart_types (0.7.1)
|
89
88
|
smart_engine (~> 0.11)
|
90
|
-
tzinfo (2.0.
|
89
|
+
tzinfo (2.0.5)
|
91
90
|
concurrent-ruby (~> 1.0)
|
92
|
-
unicode-display_width (2.
|
93
|
-
zeitwerk (2.5.1)
|
91
|
+
unicode-display_width (2.3.0)
|
94
92
|
|
95
93
|
PLATFORMS
|
96
|
-
|
97
|
-
x86_64-darwin-20
|
98
|
-
x86_64-darwin-21
|
94
|
+
arm64-darwin-21
|
99
95
|
|
100
96
|
DEPENDENCIES
|
101
|
-
armitage-rubocop (~> 1.
|
102
|
-
bundler (~> 2.
|
97
|
+
armitage-rubocop (~> 1.30)
|
98
|
+
bundler (~> 2.3)
|
103
99
|
pry (~> 0.14)
|
104
100
|
rake (~> 13.0)
|
105
|
-
rspec (~> 3.
|
101
|
+
rspec (~> 3.11)
|
106
102
|
simplecov (~> 0.21)
|
107
103
|
smart_initializer!
|
108
104
|
|
109
105
|
BUNDLED WITH
|
110
|
-
2.
|
106
|
+
2.3.17
|
data/README.md
CHANGED
@@ -71,6 +71,9 @@ in order to guarantee the validity of the SmartCore::Initializer's functionality
|
|
71
71
|
2. *(if defined)*: `default value` (default value is used when `original value` is not defined)
|
72
72
|
3. *(if defined)*: `finalize`;
|
73
73
|
|
74
|
+
- if `default`-object is a proc-object - this proc-object will be invoked in the `outer scope` of block definition;
|
75
|
+
- if `finalize`-object is a proc-object - this proc-object will be invoked in the `isntance` context (class instance);
|
76
|
+
|
74
77
|
**NOTE**: `:finalize` block are not invoked on omitted `optional: true` attributes
|
75
78
|
which has no `:default` definition bock and which are not passed to the constructor. Example:
|
76
79
|
|
@@ -96,6 +99,8 @@ end
|
|
96
99
|
User.new.age # => '0_years'
|
97
100
|
```
|
98
101
|
|
102
|
+
---
|
103
|
+
|
99
104
|
### Constructor definition DSL
|
100
105
|
|
101
106
|
**NOTE**: last `Hash` argument will be treated as `kwarg`s;
|
@@ -1,81 +1,80 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.10.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
7
|
-
smart_types (~> 0.
|
6
|
+
smart_engine (~> 0.16)
|
7
|
+
smart_types (~> 0.7)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (7.0.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
|
-
|
18
|
-
|
19
|
-
rubocop (= 1.
|
20
|
-
rubocop-
|
21
|
-
rubocop-rails (= 2.12.4)
|
17
|
+
armitage-rubocop (1.30.1.1)
|
18
|
+
rubocop (= 1.30.1)
|
19
|
+
rubocop-performance (= 1.14.2)
|
20
|
+
rubocop-rails (= 2.15.0)
|
22
21
|
rubocop-rake (= 0.6.0)
|
23
|
-
rubocop-rspec (= 2.
|
22
|
+
rubocop-rspec (= 2.11.1)
|
24
23
|
ast (2.4.2)
|
25
24
|
coderay (1.1.3)
|
26
|
-
concurrent-ruby (1.1.
|
27
|
-
diff-lcs (1.
|
28
|
-
docile (1.
|
29
|
-
i18n (1.
|
25
|
+
concurrent-ruby (1.1.10)
|
26
|
+
diff-lcs (1.5.0)
|
27
|
+
docile (1.4.0)
|
28
|
+
i18n (1.12.0)
|
30
29
|
concurrent-ruby (~> 1.0)
|
31
30
|
method_source (1.0.0)
|
32
|
-
minitest (5.
|
33
|
-
parallel (1.
|
34
|
-
parser (3.
|
31
|
+
minitest (5.16.3)
|
32
|
+
parallel (1.22.1)
|
33
|
+
parser (3.1.2.1)
|
35
34
|
ast (~> 2.4.1)
|
36
35
|
pry (0.14.1)
|
37
36
|
coderay (~> 1.1)
|
38
37
|
method_source (~> 1.0)
|
39
|
-
qonfig (0.
|
40
|
-
rack (
|
41
|
-
rainbow (3.
|
42
|
-
rake (13.0.
|
43
|
-
regexp_parser (2.
|
38
|
+
qonfig (0.28.0)
|
39
|
+
rack (3.0.0)
|
40
|
+
rainbow (3.1.1)
|
41
|
+
rake (13.0.6)
|
42
|
+
regexp_parser (2.6.0)
|
44
43
|
rexml (3.2.5)
|
45
|
-
rspec (3.
|
46
|
-
rspec-core (~> 3.
|
47
|
-
rspec-expectations (~> 3.
|
48
|
-
rspec-mocks (~> 3.
|
49
|
-
rspec-core (3.
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-expectations (3.
|
44
|
+
rspec (3.11.0)
|
45
|
+
rspec-core (~> 3.11.0)
|
46
|
+
rspec-expectations (~> 3.11.0)
|
47
|
+
rspec-mocks (~> 3.11.0)
|
48
|
+
rspec-core (3.11.0)
|
49
|
+
rspec-support (~> 3.11.0)
|
50
|
+
rspec-expectations (3.11.1)
|
52
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.11.0)
|
53
|
+
rspec-mocks (3.11.1)
|
55
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
-
rspec-support (~> 3.
|
57
|
-
rspec-support (3.
|
58
|
-
rubocop (1.
|
55
|
+
rspec-support (~> 3.11.0)
|
56
|
+
rspec-support (3.11.1)
|
57
|
+
rubocop (1.30.1)
|
59
58
|
parallel (~> 1.10)
|
60
|
-
parser (>= 3.
|
59
|
+
parser (>= 3.1.0.0)
|
61
60
|
rainbow (>= 2.2.2, < 4.0)
|
62
61
|
regexp_parser (>= 1.8, < 3.0)
|
63
|
-
rexml
|
64
|
-
rubocop-ast (>= 1.
|
62
|
+
rexml (>= 3.2.5, < 4.0)
|
63
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
65
64
|
ruby-progressbar (~> 1.7)
|
66
65
|
unicode-display_width (>= 1.4.0, < 3.0)
|
67
|
-
rubocop-ast (1.
|
68
|
-
parser (>= 3.
|
69
|
-
rubocop-performance (1.
|
66
|
+
rubocop-ast (1.21.0)
|
67
|
+
parser (>= 3.1.1.0)
|
68
|
+
rubocop-performance (1.14.2)
|
70
69
|
rubocop (>= 1.7.0, < 2.0)
|
71
70
|
rubocop-ast (>= 0.4.0)
|
72
|
-
rubocop-rails (2.
|
71
|
+
rubocop-rails (2.15.0)
|
73
72
|
activesupport (>= 4.2.0)
|
74
73
|
rack (>= 1.1)
|
75
74
|
rubocop (>= 1.7.0, < 2.0)
|
76
75
|
rubocop-rake (0.6.0)
|
77
76
|
rubocop (~> 1.0)
|
78
|
-
rubocop-rspec (2.
|
77
|
+
rubocop-rspec (2.11.1)
|
79
78
|
rubocop (~> 1.19)
|
80
79
|
ruby-progressbar (1.11.0)
|
81
80
|
simplecov (0.21.2)
|
@@ -83,29 +82,27 @@ GEM
|
|
83
82
|
simplecov-html (~> 0.11)
|
84
83
|
simplecov_json_formatter (~> 0.1)
|
85
84
|
simplecov-html (0.12.3)
|
86
|
-
simplecov_json_formatter (0.1.
|
87
|
-
smart_engine (0.
|
88
|
-
smart_types (0.7.
|
85
|
+
simplecov_json_formatter (0.1.4)
|
86
|
+
smart_engine (0.16.0)
|
87
|
+
smart_types (0.7.1)
|
89
88
|
smart_engine (~> 0.11)
|
90
89
|
thy (0.1.4)
|
91
|
-
tzinfo (2.0.
|
90
|
+
tzinfo (2.0.5)
|
92
91
|
concurrent-ruby (~> 1.0)
|
93
|
-
unicode-display_width (2.
|
94
|
-
zeitwerk (2.5.1)
|
92
|
+
unicode-display_width (2.3.0)
|
95
93
|
|
96
94
|
PLATFORMS
|
97
|
-
|
98
|
-
x86_64-darwin-21
|
95
|
+
arm64-darwin-21
|
99
96
|
|
100
97
|
DEPENDENCIES
|
101
|
-
armitage-rubocop (~> 1.
|
102
|
-
bundler (~> 2.
|
98
|
+
armitage-rubocop (~> 1.30)
|
99
|
+
bundler (~> 2.3)
|
103
100
|
pry (~> 0.14)
|
104
101
|
rake (~> 13.0)
|
105
|
-
rspec (~> 3.
|
102
|
+
rspec (~> 3.11)
|
106
103
|
simplecov (~> 0.21)
|
107
104
|
smart_initializer!
|
108
105
|
thy (~> 0.1.4)
|
109
106
|
|
110
107
|
BUNDLED WITH
|
111
|
-
2.
|
108
|
+
2.3.17
|
@@ -1,80 +1,80 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.10.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
7
|
-
smart_types (~> 0.
|
6
|
+
smart_engine (~> 0.16)
|
7
|
+
smart_types (~> 0.7)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.0.
|
12
|
+
activesupport (7.0.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
|
-
armitage-rubocop (1.
|
18
|
-
rubocop (= 1.
|
19
|
-
rubocop-performance (= 1.
|
20
|
-
rubocop-rails (= 2.
|
17
|
+
armitage-rubocop (1.30.1.1)
|
18
|
+
rubocop (= 1.30.1)
|
19
|
+
rubocop-performance (= 1.14.2)
|
20
|
+
rubocop-rails (= 2.15.0)
|
21
21
|
rubocop-rake (= 0.6.0)
|
22
|
-
rubocop-rspec (= 2.
|
22
|
+
rubocop-rspec (= 2.11.1)
|
23
23
|
ast (2.4.2)
|
24
24
|
coderay (1.1.3)
|
25
|
-
concurrent-ruby (1.1.
|
26
|
-
diff-lcs (1.
|
27
|
-
docile (1.
|
28
|
-
i18n (1.
|
25
|
+
concurrent-ruby (1.1.10)
|
26
|
+
diff-lcs (1.5.0)
|
27
|
+
docile (1.4.0)
|
28
|
+
i18n (1.12.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
method_source (1.0.0)
|
31
|
-
minitest (5.
|
32
|
-
parallel (1.
|
33
|
-
parser (3.
|
31
|
+
minitest (5.16.3)
|
32
|
+
parallel (1.22.1)
|
33
|
+
parser (3.1.2.1)
|
34
34
|
ast (~> 2.4.1)
|
35
35
|
pry (0.14.1)
|
36
36
|
coderay (~> 1.1)
|
37
37
|
method_source (~> 1.0)
|
38
|
-
qonfig (0.
|
39
|
-
rack (
|
40
|
-
rainbow (3.
|
41
|
-
rake (13.0.
|
42
|
-
regexp_parser (2.
|
38
|
+
qonfig (0.28.0)
|
39
|
+
rack (3.0.0)
|
40
|
+
rainbow (3.1.1)
|
41
|
+
rake (13.0.6)
|
42
|
+
regexp_parser (2.6.0)
|
43
43
|
rexml (3.2.5)
|
44
|
-
rspec (3.
|
45
|
-
rspec-core (~> 3.
|
46
|
-
rspec-expectations (~> 3.
|
47
|
-
rspec-mocks (~> 3.
|
48
|
-
rspec-core (3.
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-expectations (3.
|
44
|
+
rspec (3.11.0)
|
45
|
+
rspec-core (~> 3.11.0)
|
46
|
+
rspec-expectations (~> 3.11.0)
|
47
|
+
rspec-mocks (~> 3.11.0)
|
48
|
+
rspec-core (3.11.0)
|
49
|
+
rspec-support (~> 3.11.0)
|
50
|
+
rspec-expectations (3.11.1)
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.11.0)
|
53
|
+
rspec-mocks (3.11.1)
|
54
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-support (3.
|
57
|
-
rubocop (1.
|
55
|
+
rspec-support (~> 3.11.0)
|
56
|
+
rspec-support (3.11.1)
|
57
|
+
rubocop (1.30.1)
|
58
58
|
parallel (~> 1.10)
|
59
|
-
parser (>= 3.
|
59
|
+
parser (>= 3.1.0.0)
|
60
60
|
rainbow (>= 2.2.2, < 4.0)
|
61
61
|
regexp_parser (>= 1.8, < 3.0)
|
62
|
-
rexml
|
63
|
-
rubocop-ast (>= 1.
|
62
|
+
rexml (>= 3.2.5, < 4.0)
|
63
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
64
64
|
ruby-progressbar (~> 1.7)
|
65
65
|
unicode-display_width (>= 1.4.0, < 3.0)
|
66
|
-
rubocop-ast (1.
|
67
|
-
parser (>= 3.
|
68
|
-
rubocop-performance (1.
|
66
|
+
rubocop-ast (1.21.0)
|
67
|
+
parser (>= 3.1.1.0)
|
68
|
+
rubocop-performance (1.14.2)
|
69
69
|
rubocop (>= 1.7.0, < 2.0)
|
70
70
|
rubocop-ast (>= 0.4.0)
|
71
|
-
rubocop-rails (2.
|
71
|
+
rubocop-rails (2.15.0)
|
72
72
|
activesupport (>= 4.2.0)
|
73
73
|
rack (>= 1.1)
|
74
74
|
rubocop (>= 1.7.0, < 2.0)
|
75
75
|
rubocop-rake (0.6.0)
|
76
76
|
rubocop (~> 1.0)
|
77
|
-
rubocop-rspec (2.
|
77
|
+
rubocop-rspec (2.11.1)
|
78
78
|
rubocop (~> 1.19)
|
79
79
|
ruby-progressbar (1.11.0)
|
80
80
|
simplecov (0.21.2)
|
@@ -82,26 +82,25 @@ GEM
|
|
82
82
|
simplecov-html (~> 0.11)
|
83
83
|
simplecov_json_formatter (~> 0.1)
|
84
84
|
simplecov-html (0.12.3)
|
85
|
-
simplecov_json_formatter (0.1.
|
86
|
-
smart_engine (0.
|
87
|
-
smart_types (0.7.
|
85
|
+
simplecov_json_formatter (0.1.4)
|
86
|
+
smart_engine (0.16.0)
|
87
|
+
smart_types (0.7.1)
|
88
88
|
smart_engine (~> 0.11)
|
89
|
-
tzinfo (2.0.
|
89
|
+
tzinfo (2.0.5)
|
90
90
|
concurrent-ruby (~> 1.0)
|
91
|
-
unicode-display_width (2.
|
91
|
+
unicode-display_width (2.3.0)
|
92
92
|
|
93
93
|
PLATFORMS
|
94
|
-
|
95
|
-
x86_64-darwin-21
|
94
|
+
arm64-darwin-21
|
96
95
|
|
97
96
|
DEPENDENCIES
|
98
|
-
armitage-rubocop (~> 1.
|
99
|
-
bundler (~> 2.
|
97
|
+
armitage-rubocop (~> 1.30)
|
98
|
+
bundler (~> 2.3)
|
100
99
|
pry (~> 0.14)
|
101
100
|
rake (~> 13.0)
|
102
|
-
rspec (~> 3.
|
101
|
+
rspec (~> 3.11)
|
103
102
|
simplecov (~> 0.21)
|
104
103
|
smart_initializer!
|
105
104
|
|
106
105
|
BUNDLED WITH
|
107
|
-
2.
|
106
|
+
2.3.17
|
@@ -81,6 +81,7 @@ class SmartCore::Initializer::Attribute::Factory::Base
|
|
81
81
|
#
|
82
82
|
# @api private
|
83
83
|
# @since 0.8.0
|
84
|
+
# @version 0.9.1
|
84
85
|
def prepare_finalize_param(finalize)
|
85
86
|
unless finalize.is_a?(::String) || finalize.is_a?(::Symbol) || finalize.is_a?(::Proc)
|
86
87
|
raise(SmartCore::Initializer::ArgumentError, <<~ERROR_MESSAGE)
|
@@ -90,11 +91,12 @@ class SmartCore::Initializer::Attribute::Factory::Base
|
|
90
91
|
|
91
92
|
# rubocop:disable Style/SoleNestedConditional
|
92
93
|
if finalize.is_a?(::Proc) && finalize.lambda?
|
93
|
-
unless
|
94
|
+
unless allowed_lambda_arity.bsearch { |element| finalize.arity <=> element }
|
94
95
|
raise(
|
95
96
|
SmartCore::Initializer::ArgumentError,
|
96
|
-
|
97
|
-
|
97
|
+
"Lambda-based finalizer should have arity " \
|
98
|
+
"equal to #{allowed_lambda_arity.join(', ')} " \
|
99
|
+
"(your lambda object should require one attribute)"
|
98
100
|
) # TODO: show the name of attribute in error message (if the name is a valid, of course)
|
99
101
|
end
|
100
102
|
end
|
@@ -103,6 +105,13 @@ class SmartCore::Initializer::Attribute::Factory::Base
|
|
103
105
|
SmartCore::Initializer::Attribute::Finalizer.create(finalize)
|
104
106
|
end
|
105
107
|
|
108
|
+
# return [Array<Integer>]
|
109
|
+
# @api private
|
110
|
+
# @since 0.9.1
|
111
|
+
def allowed_lambda_arity
|
112
|
+
@allowed_lambda_arity ||= [-2, -1, 1].freeze
|
113
|
+
end
|
114
|
+
|
106
115
|
# @param mutable [Boolean]
|
107
116
|
# @return [Boolean]
|
108
117
|
#
|