smart_initializer 0.9.1 → 0.11.0

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: '0298953ea16ae53d51961bc46a26eefcba667f4a7d07d9d09e7d59b33f68760e'
4
- data.tar.gz: 1cdd0cde6871dcccc17641ad2870d71da26e4385f8e2df93affb96577d67f6b4
3
+ metadata.gz: '080bf0d03a329010fb6976667957ab028a86e4978fc9874e85fe51b832ecb365'
4
+ data.tar.gz: 0b37fbe8b446cacd16ac7bdbc1cf2f3a4284365b4c4cbf93ba5e11e8ede5b18e
5
5
  SHA512:
6
- metadata.gz: 4c3cf5f55e9d79003a48d655eac65470029d2b7b2565e19dee0114168585c32a4b101405635492d5431e8e8041b2d09f7a805574ea356561d12470d321878a9a
7
- data.tar.gz: 558a0037b339802ee10a9a4a60b2841cc8f6256bfa3d8576e65351d531c393cbd9542e988a5c49ecb7d30e3cae27a7b57b6f1dbb643cd56771fa3cdbb6e17315
6
+ metadata.gz: 10240a1be814be9fc50d997f6bb87b6ce8d1ea545bb0582b19f6853ab0b1031644dff6e72df323e8bfb812bd7691c8526d26dd396bfa02a24aa63c099c6b2b60
7
+ data.tar.gz: 9ecfcfe2084cbb354ee85fb6a73c2931a0304eaed0bcf9a498edf7307b908a45fc1edd037731bfb9cdc576d414b7485ddc545ee7b31058cc93ec6d5db71e149c
data/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.9.1] - 2022-03-06
4
+ ## [0.11.0] - 2022-11-25
5
+ ### Changed
6
+ - Support for *Ruby@2.5* and *Ruby@2.6* has ended;
7
+ - Reduced object allocation count during type checking process;
8
+ - Removed useless `Incorrect type` text part from `SmartCore::Initializer::IncorrectTypeError` exception message;
9
+ - Updated development dependencies;
5
10
 
6
- ### Fixed
11
+ ## [0.10.0] - 2022-10-04
12
+ ### Changed
13
+ - `SmartCore::Engine::ReadWriteLock` is used instead `SmartCore::Engine::Lock` in order to decrease the count of RubyVM's context switching and useless Mutexes usage;
14
+ - reduced `KeyError`-exception flow use cases in some cases inside the framework internals (in order to reduce object allocations under the hood);
15
+ - bumped development dependencies;
16
+ - bumped core dependencies (in order to use `ReadWiteLock` (and actualize available inner-framework features);
7
17
 
18
+ ## [0.9.1] - 2022-03-06
19
+ ### Fixed
8
20
  - `finalize` now accepts lambdas with arity `-2`. For example `->(a, *b) {}` or `:freeze.to_proc`
9
21
  which in `Ruby >= 3` returns lambda with arity equal to `-2`.
10
22
 
data/Gemfile.lock CHANGED
@@ -1,111 +1,108 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_initializer (0.9.1)
4
+ smart_initializer (0.11.0)
5
5
  qonfig (~> 0.24)
6
- smart_engine (~> 0.11)
7
- smart_types (~> 0.4)
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 (6.1.4.1)
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
- zeitwerk (~> 2.3)
18
- armitage-rubocop (1.23.0.1)
19
- rubocop (= 1.23.0)
20
- rubocop-performance (= 1.12.0)
21
- rubocop-rails (= 2.12.4)
17
+ armitage-rubocop (1.36.0)
18
+ rubocop (= 1.36.0)
19
+ rubocop-performance (= 1.15.0)
20
+ rubocop-rails (= 2.16.1)
22
21
  rubocop-rake (= 0.6.0)
23
- rubocop-rspec (= 2.6.0)
22
+ rubocop-rspec (= 2.13.2)
24
23
  ast (2.4.2)
25
24
  coderay (1.1.3)
26
- concurrent-ruby (1.1.9)
27
- diff-lcs (1.4.4)
25
+ concurrent-ruby (1.1.10)
26
+ diff-lcs (1.5.0)
28
27
  docile (1.4.0)
29
- i18n (1.8.11)
28
+ i18n (1.12.0)
30
29
  concurrent-ruby (~> 1.0)
30
+ json (2.6.2)
31
31
  method_source (1.0.0)
32
- minitest (5.14.4)
33
- parallel (1.21.0)
34
- parser (3.0.3.1)
32
+ minitest (5.16.3)
33
+ parallel (1.22.1)
34
+ parser (3.1.2.1)
35
35
  ast (~> 2.4.1)
36
36
  pry (0.14.1)
37
37
  coderay (~> 1.1)
38
38
  method_source (~> 1.0)
39
- qonfig (0.27.0)
40
- rack (2.2.3)
41
- rainbow (3.0.0)
39
+ qonfig (0.28.0)
40
+ rack (3.0.1)
41
+ rainbow (3.1.1)
42
42
  rake (13.0.6)
43
- regexp_parser (2.2.0)
43
+ regexp_parser (2.6.1)
44
44
  rexml (3.2.5)
45
- rspec (3.10.0)
46
- rspec-core (~> 3.10.0)
47
- rspec-expectations (~> 3.10.0)
48
- rspec-mocks (~> 3.10.0)
49
- rspec-core (3.10.1)
50
- rspec-support (~> 3.10.0)
51
- rspec-expectations (3.10.1)
45
+ rspec (3.12.0)
46
+ rspec-core (~> 3.12.0)
47
+ rspec-expectations (~> 3.12.0)
48
+ rspec-mocks (~> 3.12.0)
49
+ rspec-core (3.12.0)
50
+ rspec-support (~> 3.12.0)
51
+ rspec-expectations (3.12.0)
52
52
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.10.0)
54
- rspec-mocks (3.10.2)
53
+ rspec-support (~> 3.12.0)
54
+ rspec-mocks (3.12.0)
55
55
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.10.0)
57
- rspec-support (3.10.3)
58
- rubocop (1.23.0)
56
+ rspec-support (~> 3.12.0)
57
+ rspec-support (3.12.0)
58
+ rubocop (1.36.0)
59
+ json (~> 2.3)
59
60
  parallel (~> 1.10)
60
- parser (>= 3.0.0.0)
61
+ parser (>= 3.1.2.1)
61
62
  rainbow (>= 2.2.2, < 4.0)
62
63
  regexp_parser (>= 1.8, < 3.0)
63
- rexml
64
- rubocop-ast (>= 1.12.0, < 2.0)
64
+ rexml (>= 3.2.5, < 4.0)
65
+ rubocop-ast (>= 1.20.1, < 2.0)
65
66
  ruby-progressbar (~> 1.7)
66
67
  unicode-display_width (>= 1.4.0, < 3.0)
67
- rubocop-ast (1.14.0)
68
- parser (>= 3.0.1.1)
69
- rubocop-performance (1.12.0)
68
+ rubocop-ast (1.23.0)
69
+ parser (>= 3.1.1.0)
70
+ rubocop-performance (1.15.0)
70
71
  rubocop (>= 1.7.0, < 2.0)
71
72
  rubocop-ast (>= 0.4.0)
72
- rubocop-rails (2.12.4)
73
+ rubocop-rails (2.16.1)
73
74
  activesupport (>= 4.2.0)
74
75
  rack (>= 1.1)
75
- rubocop (>= 1.7.0, < 2.0)
76
+ rubocop (>= 1.33.0, < 2.0)
76
77
  rubocop-rake (0.6.0)
77
78
  rubocop (~> 1.0)
78
- rubocop-rspec (2.6.0)
79
- rubocop (~> 1.19)
79
+ rubocop-rspec (2.13.2)
80
+ rubocop (~> 1.33)
80
81
  ruby-progressbar (1.11.0)
81
82
  simplecov (0.21.2)
82
83
  docile (~> 1.1)
83
84
  simplecov-html (~> 0.11)
84
85
  simplecov_json_formatter (~> 0.1)
85
86
  simplecov-html (0.12.3)
86
- simplecov_json_formatter (0.1.3)
87
- smart_engine (0.12.0)
88
- smart_types (0.7.0)
87
+ simplecov_json_formatter (0.1.4)
88
+ smart_engine (0.17.0)
89
+ smart_types (0.8.0)
89
90
  smart_engine (~> 0.11)
90
- tzinfo (2.0.4)
91
+ tzinfo (2.0.5)
91
92
  concurrent-ruby (~> 1.0)
92
- unicode-display_width (2.1.0)
93
- zeitwerk (2.5.1)
93
+ unicode-display_width (2.3.0)
94
94
 
95
95
  PLATFORMS
96
- x86_64-darwin-19
97
- x86_64-darwin-20
98
- x86_64-darwin-21
99
- x86_64-linux
96
+ arm64-darwin-21
100
97
 
101
98
  DEPENDENCIES
102
- armitage-rubocop (~> 1.23)
103
- bundler (~> 2.2)
99
+ armitage-rubocop (~> 1.30)
100
+ bundler (~> 2.3)
104
101
  pry (~> 0.14)
105
102
  rake (~> 13.0)
106
- rspec (~> 3.10)
103
+ rspec (~> 3.11)
107
104
  simplecov (~> 0.21)
108
105
  smart_initializer!
109
106
 
110
107
  BUNDLED WITH
111
- 2.2.32
108
+ 2.3.17
@@ -1,81 +1,80 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- smart_initializer (0.9.1)
4
+ smart_initializer (0.11.0)
5
5
  qonfig (~> 0.24)
6
- smart_engine (~> 0.11)
7
- smart_types (~> 0.4)
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 (6.1.4.1)
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
- zeitwerk (~> 2.3)
18
- armitage-rubocop (1.23.0.1)
19
- rubocop (= 1.23.0)
20
- rubocop-performance (= 1.12.0)
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.6.0)
22
+ rubocop-rspec (= 2.11.1)
24
23
  ast (2.4.2)
25
24
  coderay (1.1.3)
26
- concurrent-ruby (1.1.9)
27
- diff-lcs (1.4.4)
28
- docile (1.3.5)
29
- i18n (1.8.11)
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.14.4)
33
- parallel (1.21.0)
34
- parser (3.0.3.1)
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.27.0)
40
- rack (2.2.3)
41
- rainbow (3.0.0)
42
- rake (13.0.3)
43
- regexp_parser (2.1.1)
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.10.0)
46
- rspec-core (~> 3.10.0)
47
- rspec-expectations (~> 3.10.0)
48
- rspec-mocks (~> 3.10.0)
49
- rspec-core (3.10.1)
50
- rspec-support (~> 3.10.0)
51
- rspec-expectations (3.10.1)
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.10.0)
54
- rspec-mocks (3.10.1)
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.10.0)
57
- rspec-support (3.10.1)
58
- rubocop (1.23.0)
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.0.0.0)
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.12.0, < 2.0)
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.13.0)
68
- parser (>= 3.0.1.1)
69
- rubocop-performance (1.12.0)
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.12.4)
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.6.0)
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,30 +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.2)
87
- smart_engine (0.12.0)
88
- smart_types (0.7.0)
85
+ simplecov_json_formatter (0.1.4)
86
+ smart_engine (0.17.0)
87
+ smart_types (0.8.0)
89
88
  smart_engine (~> 0.11)
90
89
  thy (0.1.4)
91
- tzinfo (2.0.4)
90
+ tzinfo (2.0.5)
92
91
  concurrent-ruby (~> 1.0)
93
- unicode-display_width (2.1.0)
94
- zeitwerk (2.5.1)
92
+ unicode-display_width (2.3.0)
95
93
 
96
94
  PLATFORMS
97
- x86_64-darwin-20
98
- x86_64-darwin-21
99
- x86_64-linux
95
+ arm64-darwin-21
100
96
 
101
97
  DEPENDENCIES
102
- armitage-rubocop (~> 1.23)
103
- bundler (~> 2.2)
98
+ armitage-rubocop (~> 1.30)
99
+ bundler (~> 2.3)
104
100
  pry (~> 0.14)
105
101
  rake (~> 13.0)
106
- rspec (~> 3.10)
102
+ rspec (~> 3.11)
107
103
  simplecov (~> 0.21)
108
104
  smart_initializer!
109
105
  thy (~> 0.1.4)
110
106
 
111
107
  BUNDLED WITH
112
- 2.2.32
108
+ 2.3.17
@@ -1,80 +1,80 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- smart_initializer (0.9.1)
4
+ smart_initializer (0.11.0)
5
5
  qonfig (~> 0.24)
6
- smart_engine (~> 0.11)
7
- smart_types (~> 0.4)
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.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.23.0.1)
18
- rubocop (= 1.23.0)
19
- rubocop-performance (= 1.12.0)
20
- 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)
21
21
  rubocop-rake (= 0.6.0)
22
- rubocop-rspec (= 2.6.0)
22
+ rubocop-rspec (= 2.11.1)
23
23
  ast (2.4.2)
24
24
  coderay (1.1.3)
25
- concurrent-ruby (1.1.9)
26
- diff-lcs (1.4.4)
27
- docile (1.3.5)
28
- i18n (1.8.11)
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.15.0)
32
- parallel (1.21.0)
33
- parser (3.0.3.2)
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.27.0)
39
- rack (2.2.3)
40
- rainbow (3.0.0)
41
- rake (13.0.3)
42
- regexp_parser (2.2.0)
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.10.0)
45
- rspec-core (~> 3.10.0)
46
- rspec-expectations (~> 3.10.0)
47
- rspec-mocks (~> 3.10.0)
48
- rspec-core (3.10.1)
49
- rspec-support (~> 3.10.0)
50
- rspec-expectations (3.10.1)
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.10.0)
53
- rspec-mocks (3.10.1)
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.10.0)
56
- rspec-support (3.10.1)
57
- rubocop (1.23.0)
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.0.0.0)
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.12.0, < 2.0)
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.15.0)
67
- parser (>= 3.0.1.1)
68
- rubocop-performance (1.12.0)
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.12.4)
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.6.0)
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,27 +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.2)
86
- smart_engine (0.12.0)
87
- smart_types (0.7.0)
85
+ simplecov_json_formatter (0.1.4)
86
+ smart_engine (0.17.0)
87
+ smart_types (0.8.0)
88
88
  smart_engine (~> 0.11)
89
- tzinfo (2.0.4)
89
+ tzinfo (2.0.5)
90
90
  concurrent-ruby (~> 1.0)
91
- unicode-display_width (2.1.0)
91
+ unicode-display_width (2.3.0)
92
92
 
93
93
  PLATFORMS
94
- x86_64-darwin-20
95
- x86_64-darwin-21
96
- x86_64-linux
94
+ arm64-darwin-21
97
95
 
98
96
  DEPENDENCIES
99
- armitage-rubocop (~> 1.23)
100
- bundler (~> 2.2)
97
+ armitage-rubocop (~> 1.30)
98
+ bundler (~> 2.3)
101
99
  pry (~> 0.14)
102
100
  rake (~> 13.0)
103
- rspec (~> 3.10)
101
+ rspec (~> 3.11)
104
102
  simplecov (~> 0.21)
105
103
  smart_initializer!
106
104
 
107
105
  BUNDLED WITH
108
- 2.2.32
106
+ 2.3.17
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Attribute::List
6
7
  # @since 0.1.0
7
8
  include Enumerable
@@ -10,9 +11,10 @@ class SmartCore::Initializer::Attribute::List
10
11
  #
11
12
  # @api private
12
13
  # @since 0.1.0
14
+ # @version 0.10.0
13
15
  def initialize
14
16
  @attributes = {}
15
- @lock = SmartCore::Engine::Lock.new
17
+ @lock = SmartCore::Engine::ReadWriteLock.new
16
18
  end
17
19
 
18
20
  # @param attribute_name [Symbol]
@@ -22,15 +24,16 @@ class SmartCore::Initializer::Attribute::List
22
24
  #
23
25
  # @api private
24
26
  # @since 0.8.0
27
+ # @version 0.10.0
25
28
  def fetch(attribute_name)
26
- thread_safe do
27
- attributes.fetch(attribute_name)
28
- rescue ::KeyError
29
+ @lock.read_sync do
29
30
  raise(
30
31
  ::SmartCore::Initializer::UndefinedAttributeError,
31
32
  "Attribute with `#{attribute_name}` name is not defined in your constructor. " \
32
33
  "Please, check your attribute definitions inside your class."
33
- )
34
+ ) unless attributes.key?(attribute_name)
35
+
36
+ attributes[attribute_name]
34
37
  end
35
38
  end
36
39
  alias_method :[], :fetch
@@ -40,8 +43,9 @@ class SmartCore::Initializer::Attribute::List
40
43
  #
41
44
  # @api private
42
45
  # @since 0.1.0
46
+ # @version 0.10.0
43
47
  def add(attribute)
44
- thread_safe { attributes[attribute.name] = attribute }
48
+ @lock.write_sync { attributes[attribute.name] = attribute }
45
49
  end
46
50
  alias_method :<<, :add
47
51
 
@@ -50,8 +54,9 @@ class SmartCore::Initializer::Attribute::List
50
54
  #
51
55
  # @api private
52
56
  # @since 0.1.0
57
+ # @version 0.10.0
53
58
  def concat(list)
54
- thread_safe do
59
+ @lock.write_sync do
55
60
  list.each { |attribute| add(attribute.dup) }
56
61
  end
57
62
  end
@@ -62,7 +67,7 @@ class SmartCore::Initializer::Attribute::List
62
67
  # @api private
63
68
  # @since 0.1.0
64
69
  def include?(attribute)
65
- thread_safe { attributes.key?(attribute.name) }
70
+ @lock.read_sync { attributes.key?(attribute.name) }
66
71
  end
67
72
 
68
73
  # @param block [Block]
@@ -70,8 +75,9 @@ class SmartCore::Initializer::Attribute::List
70
75
  #
71
76
  # @api private
72
77
  # @since 0.1.0
78
+ # @version 0.10.0
73
79
  def each(&block)
74
- thread_safe do
80
+ @lock.read_sync do
75
81
  block_given? ? attributes.values.each(&block) : attributes.values.each
76
82
  end
77
83
  end
@@ -80,8 +86,9 @@ class SmartCore::Initializer::Attribute::List
80
86
  #
81
87
  # @api private
82
88
  # @since 0.1.0
89
+ # @version 0.10.0
83
90
  def size
84
- thread_safe { attributes.size }
91
+ @lock.read_sync { attributes.size }
85
92
  end
86
93
 
87
94
  # @param block [Block]
@@ -89,8 +96,9 @@ class SmartCore::Initializer::Attribute::List
89
96
  #
90
97
  # @api private
91
98
  # @since 0.1.0
99
+ # @version 0.10.0
92
100
  def count(&block)
93
- thread_safe { attributes.values.count(&block) }
101
+ @lock.read_sync { attributes.values.count(&block) }
94
102
  end
95
103
 
96
104
  private
@@ -100,13 +108,4 @@ class SmartCore::Initializer::Attribute::List
100
108
  # @api private
101
109
  # @since 0.1.0
102
110
  attr_reader :attributes
103
-
104
- # @param block [Block]
105
- # @return [Any]
106
- #
107
- # @api private
108
- # @since 0.1.0
109
- def thread_safe(&block)
110
- @lock.synchronize(&block)
111
- end
112
111
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.8.0
5
+ # @version 0.11.0
5
6
  class SmartCore::Initializer::Attribute::Value::Base
6
7
  # @return [Hash<Symbol,Symbol>]
7
8
  #
@@ -114,15 +115,16 @@ class SmartCore::Initializer::Attribute::Value::Base
114
115
  # @param value [Any]
115
116
  # @return [void]
116
117
  #
118
+ # @raise [SmartCore::Initializer::IncorrectTypeError]
119
+ #
117
120
  # @api private
118
121
  # @since 0.8.0
122
+ # @version 0.11.0
119
123
  def validate!(value)
120
- type.validate!(value)
121
- rescue => error # TODO: move to typesystem interop
122
124
  raise(
123
125
  SmartCore::Initializer::IncorrectTypeError,
124
126
  "Validation of attribute `#{name}` failed:" \
125
- "(expected: #{type.identifier}, got: #{value.class}) \"#{error.message}\""
126
- )
127
+ "(expected: #{type.identifier}, got: #{value.class})"
128
+ ) unless type.valid?(value)
127
129
  end
128
130
  end