smart_initializer 0.9.1 → 0.10.0

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
  SHA256:
3
- metadata.gz: '0298953ea16ae53d51961bc46a26eefcba667f4a7d07d9d09e7d59b33f68760e'
4
- data.tar.gz: 1cdd0cde6871dcccc17641ad2870d71da26e4385f8e2df93affb96577d67f6b4
3
+ metadata.gz: f071c193e7dba7c0e30acf950159bc97f41933bbb7a6cb2e04838b1de474c0d7
4
+ data.tar.gz: 5867c7ffc8181767a85ad0d609ca3a1d9c6697e4eb0abaa3e9997341cc237165
5
5
  SHA512:
6
- metadata.gz: 4c3cf5f55e9d79003a48d655eac65470029d2b7b2565e19dee0114168585c32a4b101405635492d5431e8e8041b2d09f7a805574ea356561d12470d321878a9a
7
- data.tar.gz: 558a0037b339802ee10a9a4a60b2841cc8f6256bfa3d8576e65351d531c393cbd9542e988a5c49ecb7d30e3cae27a7b57b6f1dbb643cd56771fa3cdbb6e17315
6
+ metadata.gz: e964ae02c95f010da48499b508c8f5bd755aa0b44165fe173dcdd80385f4c1006fc469ebf5568303f5f47e58cb514c0f4a1e10b5062b2db5b953f57b3bda8549
7
+ data.tar.gz: 8907288d0ff34f3f76d6bf5291cce236413ef998a944966f90074e871126809b98c7ed16890ecf84a338da22096e108a6d40d84f640d602628ae97a5cc9656fd
data/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
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.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);
5
10
 
11
+ ## [0.9.1] - 2022-03-06
6
12
  ### Fixed
7
-
8
13
  - `finalize` now accepts lambdas with arity `-2`. For example `->(a, *b) {}` or `:freeze.to_proc`
9
14
  which in `Ruby >= 3` returns lambda with arity equal to `-2`.
10
15
 
data/Gemfile.lock CHANGED
@@ -1,81 +1,80 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_initializer (0.9.1)
4
+ smart_initializer (0.10.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)
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)
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)
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.2.0)
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.2)
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.3)
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.14.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,29 +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.3)
87
- smart_engine (0.12.0)
88
- smart_types (0.7.0)
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.4)
89
+ tzinfo (2.0.5)
91
90
  concurrent-ruby (~> 1.0)
92
- unicode-display_width (2.1.0)
93
- zeitwerk (2.5.1)
91
+ unicode-display_width (2.3.0)
94
92
 
95
93
  PLATFORMS
96
- x86_64-darwin-19
97
- x86_64-darwin-20
98
- x86_64-darwin-21
99
- x86_64-linux
94
+ arm64-darwin-21
100
95
 
101
96
  DEPENDENCIES
102
- armitage-rubocop (~> 1.23)
103
- bundler (~> 2.2)
97
+ armitage-rubocop (~> 1.30)
98
+ bundler (~> 2.3)
104
99
  pry (~> 0.14)
105
100
  rake (~> 13.0)
106
- rspec (~> 3.10)
101
+ rspec (~> 3.11)
107
102
  simplecov (~> 0.21)
108
103
  smart_initializer!
109
104
 
110
105
  BUNDLED WITH
111
- 2.2.32
106
+ 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.10.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.16.0)
87
+ smart_types (0.7.1)
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.10.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.16.0)
87
+ smart_types (0.7.1)
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