smart_initializer 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +70 -61
- data/README.md +29 -3
- data/bin/console +3 -3
- data/gemfiles/with_external_deps.gemfile.lock +69 -60
- data/gemfiles/without_external_deps.gemfile.lock +62 -60
- data/lib/smart_core/initializer/attribute.rb +20 -2
- data/lib/smart_core/initializer/attribute/factory.rb +43 -3
- data/lib/smart_core/initializer/attribute/parameters.rb +30 -1
- data/lib/smart_core/initializer/constructor/definer.rb +48 -4
- data/lib/smart_core/initializer/dsl.rb +13 -3
- data/lib/smart_core/initializer/plugins.rb +1 -1
- data/lib/smart_core/initializer/plugins/abstract.rb +2 -2
- data/lib/smart_core/initializer/version.rb +2 -2
- data/smart_initializer.gemspec +7 -6
- metadata +32 -19
- data/.travis.yml +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8963960f317fc7217bedf7a6974970a4380043edbee19061f08ff6d51505147
|
4
|
+
data.tar.gz: 9bb224a8135f877c610e9a9941e9f0101c2dd8752d34e2834a60abbe59a6ca3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2113967924a39041db63a8686ecbeb47c322f39a751bb7f8ceb563f34342c6db02a65db666b65962720ff93e22e34872d1df43b38ca19daa738a98d340d9efe6
|
7
|
+
data.tar.gz: a6df46968cd156ebf62bd410fedba372fab4f5319cdc7df0224343729e44ef477bf0eff2ec4bbc2d1aa3c5a39cfd532ea759ef2a71d4f41eecd95e1fae7ebbd3
|
data/.rubocop.yml
CHANGED
@@ -5,15 +5,22 @@ inherit_gem:
|
|
5
5
|
- lib/rubocop.rspec.yml
|
6
6
|
|
7
7
|
AllCops:
|
8
|
-
TargetRubyVersion:
|
8
|
+
TargetRubyVersion: 3.0.0
|
9
|
+
NewCops: enable
|
9
10
|
Include:
|
10
11
|
- lib/**/*.rb
|
11
12
|
- spec/**/*.rb
|
12
13
|
- Gemfile
|
13
14
|
- Rakefile
|
14
15
|
- smart_initializer.gemspec
|
16
|
+
- gemfiles/*.gemfile
|
15
17
|
- bin/console
|
16
18
|
|
17
19
|
# NOTE: It is not suitable for infrastracture-level frameworks
|
18
20
|
Metrics/ParameterLists:
|
19
21
|
Enabled: false
|
22
|
+
|
23
|
+
# NOTE: It is ok to use empty blocks in specs (inside simple test cases)
|
24
|
+
Lint/EmptyBlock:
|
25
|
+
Exclude:
|
26
|
+
- spec/**/*.rb
|
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.4.0] - 2020-01-18
|
5
|
+
### Added
|
6
|
+
- Attribue Definition DSL
|
7
|
+
- Support for specifying the attribute accessor type (`read_only` parameter);
|
8
|
+
- Support for attribute aliasing (`as` parameter);
|
9
|
+
- Support for **Ruby 3**;
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- Moved from `TravisCI` to nothing (todo: migrate to `GitHub Actions`).
|
13
|
+
Temporary: we must run test cases locally.
|
14
|
+
- Updated development dependencies;
|
15
|
+
|
4
16
|
## [0.3.2] - 2020-07-12
|
5
17
|
### Fixed
|
6
18
|
- Deeply inherited entities lose their `__initializer_settings__` entitiy;
|
data/Gemfile.lock
CHANGED
@@ -1,100 +1,109 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.4.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
7
|
-
smart_types (~> 0.1
|
6
|
+
smart_engine (~> 0.11)
|
7
|
+
smart_types (~> 0.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (=
|
20
|
-
rubocop-performance (= 1.
|
21
|
-
rubocop-rails (= 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
armitage-rubocop (1.7.0.1)
|
19
|
+
rubocop (= 1.7.0)
|
20
|
+
rubocop-performance (= 1.9.1)
|
21
|
+
rubocop-rails (= 2.9.1)
|
22
22
|
rubocop-rake (= 0.5.1)
|
23
|
-
rubocop-rspec (= 1.
|
23
|
+
rubocop-rspec (= 2.1.0)
|
24
24
|
ast (2.4.1)
|
25
|
-
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.1.7)
|
26
27
|
diff-lcs (1.4.4)
|
27
|
-
docile (1.3.
|
28
|
-
i18n (1.8.
|
28
|
+
docile (1.3.5)
|
29
|
+
i18n (1.8.7)
|
29
30
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
method_source (1.0.0)
|
32
|
+
minitest (5.14.3)
|
33
|
+
parallel (1.20.1)
|
34
|
+
parser (3.0.0.0)
|
33
35
|
ast (~> 2.4.1)
|
34
|
-
|
36
|
+
pry (0.13.1)
|
37
|
+
coderay (~> 1.1)
|
38
|
+
method_source (~> 1.0)
|
39
|
+
qonfig (0.25.0)
|
35
40
|
rack (2.2.3)
|
36
41
|
rainbow (3.0.0)
|
37
|
-
rake (13.0.
|
38
|
-
regexp_parser (
|
42
|
+
rake (13.0.3)
|
43
|
+
regexp_parser (2.0.3)
|
39
44
|
rexml (3.2.4)
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
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)
|
47
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
53
|
+
rspec-support (~> 3.10.0)
|
54
|
+
rspec-mocks (3.10.1)
|
50
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (
|
56
|
+
rspec-support (~> 3.10.0)
|
57
|
+
rspec-support (3.10.1)
|
58
|
+
rubocop (1.7.0)
|
54
59
|
parallel (~> 1.10)
|
55
|
-
parser (>= 2.7.1.
|
60
|
+
parser (>= 2.7.1.5)
|
56
61
|
rainbow (>= 2.2.2, < 4.0)
|
57
|
-
regexp_parser (>= 1.
|
62
|
+
regexp_parser (>= 1.8, < 3.0)
|
58
63
|
rexml
|
59
|
-
rubocop-ast (>=
|
64
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
60
65
|
ruby-progressbar (~> 1.7)
|
61
66
|
unicode-display_width (>= 1.4.0, < 2.0)
|
62
|
-
rubocop-ast (
|
63
|
-
parser (>= 2.7.
|
64
|
-
rubocop-performance (1.
|
65
|
-
rubocop (>= 0.
|
66
|
-
|
67
|
+
rubocop-ast (1.4.0)
|
68
|
+
parser (>= 2.7.1.5)
|
69
|
+
rubocop-performance (1.9.1)
|
70
|
+
rubocop (>= 0.90.0, < 2.0)
|
71
|
+
rubocop-ast (>= 0.4.0)
|
72
|
+
rubocop-rails (2.9.1)
|
67
73
|
activesupport (>= 4.2.0)
|
68
74
|
rack (>= 1.1)
|
69
|
-
rubocop (>= 0.
|
75
|
+
rubocop (>= 0.90.0, < 2.0)
|
70
76
|
rubocop-rake (0.5.1)
|
71
77
|
rubocop
|
72
|
-
rubocop-rspec (1.
|
73
|
-
rubocop (
|
74
|
-
|
75
|
-
|
78
|
+
rubocop-rspec (2.1.0)
|
79
|
+
rubocop (~> 1.0)
|
80
|
+
rubocop-ast (>= 1.1.0)
|
81
|
+
ruby-progressbar (1.11.0)
|
82
|
+
simplecov (0.21.2)
|
76
83
|
docile (~> 1.1)
|
77
84
|
simplecov-html (~> 0.11)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
+
simplecov_json_formatter (~> 0.1)
|
86
|
+
simplecov-html (0.12.3)
|
87
|
+
simplecov_json_formatter (0.1.2)
|
88
|
+
smart_engine (0.11.0)
|
89
|
+
smart_types (0.3.0)
|
90
|
+
smart_engine (~> 0.10)
|
91
|
+
tzinfo (2.0.4)
|
92
|
+
concurrent-ruby (~> 1.0)
|
85
93
|
unicode-display_width (1.7.0)
|
86
|
-
zeitwerk (2.
|
94
|
+
zeitwerk (2.4.2)
|
87
95
|
|
88
96
|
PLATFORMS
|
89
|
-
|
97
|
+
x86_64-darwin-20
|
90
98
|
|
91
99
|
DEPENDENCIES
|
92
|
-
armitage-rubocop (~>
|
93
|
-
bundler (~> 2.
|
100
|
+
armitage-rubocop (~> 1.7)
|
101
|
+
bundler (~> 2.2)
|
102
|
+
pry (~> 0.13)
|
94
103
|
rake (~> 13.0)
|
95
|
-
rspec (~> 3.
|
96
|
-
simplecov (~> 0.
|
104
|
+
rspec (~> 3.10)
|
105
|
+
simplecov (~> 0.21)
|
97
106
|
smart_initializer!
|
98
107
|
|
99
108
|
BUNDLED WITH
|
100
|
-
2.
|
109
|
+
2.2.3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# SmartCore::Initializer · [![Gem Version](https://badge.fury.io/rb/smart_initializer.svg)](https://badge.fury.io/rb/smart_initializer)
|
1
|
+
# SmartCore::Initializer · [![Gem Version](https://badge.fury.io/rb/smart_initializer.svg)](https://badge.fury.io/rb/smart_initializer)
|
2
2
|
|
3
3
|
A simple and convenient way to declare complex constructors with a support for various commonly used type systems.
|
4
4
|
(**in active development**).
|
@@ -30,7 +30,8 @@ require 'smart_core/initializer'
|
|
30
30
|
- [Initialization extension](#initialization-extension)
|
31
31
|
- [Plugins](#plugins)
|
32
32
|
- [thy-types](#plugin-thy-types)
|
33
|
-
- [
|
33
|
+
- [Roadmap](#roadmap)
|
34
|
+
- [Build](#build)
|
34
35
|
|
35
36
|
---
|
36
37
|
|
@@ -286,7 +287,18 @@ User.new(123, 'test', { admin: true, age: 22 })
|
|
286
287
|
|
287
288
|
---
|
288
289
|
|
289
|
-
##
|
290
|
+
## Roadmap
|
291
|
+
|
292
|
+
- Attribue Definition DSL
|
293
|
+
- Support for specifying the attribute accessor type (`read_only` parameter);
|
294
|
+
- Support for attribute aliasing (`as` parameter);
|
295
|
+
- Migrate from `TravisCI` to `GitHub Actions`;
|
296
|
+
|
297
|
+
---
|
298
|
+
|
299
|
+
## Build
|
300
|
+
|
301
|
+
### Tests Running
|
290
302
|
|
291
303
|
- with plugin tests:
|
292
304
|
|
@@ -306,6 +318,20 @@ bin/rspec -n
|
|
306
318
|
bin/rspec -h
|
307
319
|
```
|
308
320
|
|
321
|
+
### Code Style Checking
|
322
|
+
|
323
|
+
- without auto-correction:
|
324
|
+
|
325
|
+
```shell
|
326
|
+
bundle exec rake rubocop
|
327
|
+
```
|
328
|
+
|
329
|
+
- with auto-correction:
|
330
|
+
|
331
|
+
```shell
|
332
|
+
bundle exec rake rubocop -A
|
333
|
+
```
|
334
|
+
|
309
335
|
---
|
310
336
|
|
311
337
|
## Contributing
|
data/bin/console
CHANGED
@@ -1,102 +1,111 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.4.0)
|
5
5
|
qonfig (~> 0.24)
|
6
|
-
smart_engine (~> 0.
|
7
|
-
smart_types (~> 0.1
|
6
|
+
smart_engine (~> 0.11)
|
7
|
+
smart_types (~> 0.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (=
|
20
|
-
rubocop-performance (= 1.
|
21
|
-
rubocop-rails (= 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
armitage-rubocop (1.7.0.1)
|
19
|
+
rubocop (= 1.7.0)
|
20
|
+
rubocop-performance (= 1.9.1)
|
21
|
+
rubocop-rails (= 2.9.1)
|
22
22
|
rubocop-rake (= 0.5.1)
|
23
|
-
rubocop-rspec (= 1.
|
23
|
+
rubocop-rspec (= 2.1.0)
|
24
24
|
ast (2.4.1)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.1.7)
|
27
|
+
diff-lcs (1.4.4)
|
28
|
+
docile (1.3.5)
|
29
|
+
i18n (1.8.7)
|
29
30
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
method_source (1.0.0)
|
32
|
+
minitest (5.14.3)
|
33
|
+
parallel (1.20.1)
|
34
|
+
parser (3.0.0.0)
|
33
35
|
ast (~> 2.4.1)
|
34
|
-
|
36
|
+
pry (0.13.1)
|
37
|
+
coderay (~> 1.1)
|
38
|
+
method_source (~> 1.0)
|
39
|
+
qonfig (0.25.0)
|
35
40
|
rack (2.2.3)
|
36
41
|
rainbow (3.0.0)
|
37
|
-
rake (13.0.
|
38
|
-
regexp_parser (
|
42
|
+
rake (13.0.3)
|
43
|
+
regexp_parser (2.0.3)
|
39
44
|
rexml (3.2.4)
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
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)
|
47
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
53
|
+
rspec-support (~> 3.10.0)
|
54
|
+
rspec-mocks (3.10.1)
|
50
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (
|
56
|
+
rspec-support (~> 3.10.0)
|
57
|
+
rspec-support (3.10.1)
|
58
|
+
rubocop (1.7.0)
|
54
59
|
parallel (~> 1.10)
|
55
|
-
parser (>= 2.7.1.
|
60
|
+
parser (>= 2.7.1.5)
|
56
61
|
rainbow (>= 2.2.2, < 4.0)
|
57
|
-
regexp_parser (>= 1.
|
62
|
+
regexp_parser (>= 1.8, < 3.0)
|
58
63
|
rexml
|
59
|
-
rubocop-ast (>=
|
64
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
60
65
|
ruby-progressbar (~> 1.7)
|
61
66
|
unicode-display_width (>= 1.4.0, < 2.0)
|
62
|
-
rubocop-ast (
|
63
|
-
parser (>= 2.7.
|
64
|
-
rubocop-performance (1.
|
65
|
-
rubocop (>= 0.
|
66
|
-
|
67
|
+
rubocop-ast (1.4.0)
|
68
|
+
parser (>= 2.7.1.5)
|
69
|
+
rubocop-performance (1.9.1)
|
70
|
+
rubocop (>= 0.90.0, < 2.0)
|
71
|
+
rubocop-ast (>= 0.4.0)
|
72
|
+
rubocop-rails (2.9.1)
|
67
73
|
activesupport (>= 4.2.0)
|
68
74
|
rack (>= 1.1)
|
69
|
-
rubocop (>= 0.
|
75
|
+
rubocop (>= 0.90.0, < 2.0)
|
70
76
|
rubocop-rake (0.5.1)
|
71
77
|
rubocop
|
72
|
-
rubocop-rspec (1.
|
73
|
-
rubocop (
|
74
|
-
|
75
|
-
|
78
|
+
rubocop-rspec (2.1.0)
|
79
|
+
rubocop (~> 1.0)
|
80
|
+
rubocop-ast (>= 1.1.0)
|
81
|
+
ruby-progressbar (1.11.0)
|
82
|
+
simplecov (0.21.2)
|
76
83
|
docile (~> 1.1)
|
77
84
|
simplecov-html (~> 0.11)
|
78
|
-
|
79
|
-
|
85
|
+
simplecov_json_formatter (~> 0.1)
|
86
|
+
simplecov-html (0.12.3)
|
87
|
+
simplecov_json_formatter (0.1.2)
|
88
|
+
smart_engine (0.11.0)
|
80
89
|
smart_types (0.1.0)
|
81
90
|
smart_engine (~> 0.6)
|
82
|
-
thread_safe (0.3.6)
|
83
91
|
thy (0.1.4)
|
84
|
-
tzinfo (
|
85
|
-
|
92
|
+
tzinfo (2.0.4)
|
93
|
+
concurrent-ruby (~> 1.0)
|
86
94
|
unicode-display_width (1.7.0)
|
87
|
-
zeitwerk (2.
|
95
|
+
zeitwerk (2.4.2)
|
88
96
|
|
89
97
|
PLATFORMS
|
90
|
-
|
98
|
+
x86_64-darwin-20
|
91
99
|
|
92
100
|
DEPENDENCIES
|
93
|
-
armitage-rubocop (~>
|
94
|
-
bundler (~> 2.
|
101
|
+
armitage-rubocop (~> 1.7)
|
102
|
+
bundler (~> 2.2)
|
103
|
+
pry (~> 0.13)
|
95
104
|
rake (~> 13.0)
|
96
|
-
rspec (~> 3.
|
97
|
-
simplecov (~> 0.
|
105
|
+
rspec (~> 3.10)
|
106
|
+
simplecov (~> 0.21)
|
98
107
|
smart_initializer!
|
99
108
|
thy (~> 0.1.4)
|
100
109
|
|
101
110
|
BUNDLED WITH
|
102
|
-
2.
|
111
|
+
2.2.3
|
@@ -1,95 +1,97 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.2
|
4
|
+
smart_initializer (0.3.2)
|
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.
|
12
|
+
activesupport (6.1.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (= 0.
|
20
|
-
rubocop-performance (= 1.
|
21
|
-
rubocop-rails (= 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
armitage-rubocop (0.93.1)
|
19
|
+
rubocop (= 0.93.1)
|
20
|
+
rubocop-performance (= 1.8.1)
|
21
|
+
rubocop-rails (= 2.8.1)
|
22
22
|
rubocop-rake (= 0.5.1)
|
23
|
-
rubocop-rspec (= 1.
|
24
|
-
ast (2.4.
|
25
|
-
concurrent-ruby (1.1.
|
26
|
-
diff-lcs (1.
|
27
|
-
docile (1.3.
|
28
|
-
i18n (1.8.
|
23
|
+
rubocop-rspec (= 1.43.2)
|
24
|
+
ast (2.4.1)
|
25
|
+
concurrent-ruby (1.1.7)
|
26
|
+
diff-lcs (1.4.4)
|
27
|
+
docile (1.3.5)
|
28
|
+
i18n (1.8.7)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
minitest (5.14.
|
31
|
-
parallel (1.
|
32
|
-
parser (
|
33
|
-
ast (~> 2.4.
|
34
|
-
qonfig (0.
|
35
|
-
rack (2.2.
|
30
|
+
minitest (5.14.3)
|
31
|
+
parallel (1.20.1)
|
32
|
+
parser (3.0.0.0)
|
33
|
+
ast (~> 2.4.1)
|
34
|
+
qonfig (0.25.0)
|
35
|
+
rack (2.2.3)
|
36
36
|
rainbow (3.0.0)
|
37
|
-
rake (13.0.
|
38
|
-
regexp_parser (
|
37
|
+
rake (13.0.3)
|
38
|
+
regexp_parser (2.0.3)
|
39
39
|
rexml (3.2.4)
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
40
|
+
rspec (3.10.0)
|
41
|
+
rspec-core (~> 3.10.0)
|
42
|
+
rspec-expectations (~> 3.10.0)
|
43
|
+
rspec-mocks (~> 3.10.0)
|
44
|
+
rspec-core (3.10.1)
|
45
|
+
rspec-support (~> 3.10.0)
|
46
|
+
rspec-expectations (3.10.1)
|
47
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-mocks (3.10.1)
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (0.
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-support (3.10.1)
|
53
|
+
rubocop (0.93.1)
|
54
54
|
parallel (~> 1.10)
|
55
|
-
parser (>= 2.7.
|
55
|
+
parser (>= 2.7.1.5)
|
56
56
|
rainbow (>= 2.2.2, < 4.0)
|
57
|
-
regexp_parser (>= 1.
|
57
|
+
regexp_parser (>= 1.8)
|
58
58
|
rexml
|
59
|
-
rubocop-ast (>= 0.0
|
59
|
+
rubocop-ast (>= 0.6.0)
|
60
60
|
ruby-progressbar (~> 1.7)
|
61
61
|
unicode-display_width (>= 1.4.0, < 2.0)
|
62
|
-
rubocop-ast (
|
63
|
-
parser (>= 2.7.
|
64
|
-
rubocop-performance (1.
|
65
|
-
rubocop (>= 0.
|
66
|
-
|
67
|
-
|
62
|
+
rubocop-ast (1.4.0)
|
63
|
+
parser (>= 2.7.1.5)
|
64
|
+
rubocop-performance (1.8.1)
|
65
|
+
rubocop (>= 0.87.0)
|
66
|
+
rubocop-ast (>= 0.4.0)
|
67
|
+
rubocop-rails (2.8.1)
|
68
|
+
activesupport (>= 4.2.0)
|
68
69
|
rack (>= 1.1)
|
69
|
-
rubocop (>= 0.
|
70
|
+
rubocop (>= 0.87.0)
|
70
71
|
rubocop-rake (0.5.1)
|
71
72
|
rubocop
|
72
|
-
rubocop-rspec (1.
|
73
|
-
rubocop (
|
74
|
-
ruby-progressbar (1.
|
75
|
-
simplecov (0.
|
73
|
+
rubocop-rspec (1.43.2)
|
74
|
+
rubocop (~> 0.87)
|
75
|
+
ruby-progressbar (1.11.0)
|
76
|
+
simplecov (0.21.2)
|
76
77
|
docile (~> 1.1)
|
77
78
|
simplecov-html (~> 0.11)
|
78
|
-
|
79
|
-
|
79
|
+
simplecov_json_formatter (~> 0.1)
|
80
|
+
simplecov-html (0.12.3)
|
81
|
+
simplecov_json_formatter (0.1.2)
|
82
|
+
smart_engine (0.11.0)
|
80
83
|
smart_types (0.1.0)
|
81
84
|
smart_engine (~> 0.6)
|
82
|
-
|
83
|
-
|
84
|
-
thread_safe (~> 0.1)
|
85
|
+
tzinfo (2.0.4)
|
86
|
+
concurrent-ruby (~> 1.0)
|
85
87
|
unicode-display_width (1.7.0)
|
86
|
-
zeitwerk (2.
|
88
|
+
zeitwerk (2.4.2)
|
87
89
|
|
88
90
|
PLATFORMS
|
89
|
-
|
91
|
+
x86_64-darwin-20
|
90
92
|
|
91
93
|
DEPENDENCIES
|
92
|
-
armitage-rubocop (~> 0.
|
94
|
+
armitage-rubocop (~> 0.87)
|
93
95
|
bundler (~> 2.1)
|
94
96
|
rake (~> 13.0)
|
95
97
|
rspec (~> 3.9)
|
@@ -97,4 +99,4 @@ DEPENDENCIES
|
|
97
99
|
smart_initializer!
|
98
100
|
|
99
101
|
BUNDLED WITH
|
100
|
-
2.
|
102
|
+
2.2.3
|
@@ -59,20 +59,34 @@ class SmartCore::Initializer::Attribute
|
|
59
59
|
# @since 0.1.0
|
60
60
|
def_delegator :parameters, :has_default?
|
61
61
|
|
62
|
+
# @return [Boolean]
|
63
|
+
#
|
64
|
+
# @api private
|
65
|
+
# @since 0.4.0
|
66
|
+
def_delegator :parameters, :read_only
|
67
|
+
|
68
|
+
# @return [String, Symbol, NilClass]
|
69
|
+
#
|
70
|
+
# @api private
|
71
|
+
# @since 0.4.0
|
72
|
+
def_delegator :parameters, :as
|
73
|
+
|
62
74
|
# @param name [Symbol]
|
63
75
|
# @param type [SmartCore::Initializer::TypeSystem::Interop]
|
64
76
|
# @param type_system [Class<SmartCore::Initializer::TypeSystem::Interop>]
|
65
77
|
# @param privacy [Symbol]
|
66
78
|
# @param finalizer [SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock/InstanceMethod]
|
67
79
|
# @param cast [Boolean]
|
80
|
+
# @param read_only [Boolean]
|
81
|
+
# @param as [String, Symbol, NilClass]
|
68
82
|
# @param dynamic_options [Hash<Symbol,Any>]
|
69
83
|
# @return [void]
|
70
84
|
#
|
71
85
|
# @api private
|
72
86
|
# @since 0.1.0
|
73
|
-
def initialize(name, type, type_system, privacy, finalizer, cast, dynamic_options)
|
87
|
+
def initialize(name, type, type_system, privacy, finalizer, cast, read_only, as, dynamic_options)
|
74
88
|
@parameters = SmartCore::Initializer::Attribute::Parameters.new(
|
75
|
-
name, type, type_system, privacy, finalizer, cast, dynamic_options
|
89
|
+
name, type, type_system, privacy, finalizer, cast, read_only, as, dynamic_options
|
76
90
|
)
|
77
91
|
end
|
78
92
|
|
@@ -80,6 +94,7 @@ class SmartCore::Initializer::Attribute
|
|
80
94
|
#
|
81
95
|
# @api private
|
82
96
|
# @since 0.1.0
|
97
|
+
# rubocop:disable Metrics/AbcSize
|
83
98
|
def dup
|
84
99
|
self.class.new(
|
85
100
|
parameters.name.dup,
|
@@ -88,9 +103,12 @@ class SmartCore::Initializer::Attribute
|
|
88
103
|
parameters.privacy,
|
89
104
|
parameters.finalizer.dup,
|
90
105
|
parameters.cast,
|
106
|
+
parameters.read_only,
|
107
|
+
parameters.as,
|
91
108
|
parameters.dynamic_options.dup
|
92
109
|
)
|
93
110
|
end
|
111
|
+
# rubocop:enable Metrics/AbcSize
|
94
112
|
|
95
113
|
private
|
96
114
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# @api private
|
4
4
|
# @since 0.1.0
|
5
|
+
# rubocop:disable Metrics/ClassLength
|
5
6
|
class SmartCore::Initializer::Attribute::Factory
|
6
7
|
class << self
|
7
8
|
# @param name [String, Symbol]
|
@@ -10,18 +11,22 @@ class SmartCore::Initializer::Attribute::Factory
|
|
10
11
|
# @param privacy [String, Symbol]
|
11
12
|
# @param finalize [String, Symbol, Proc]
|
12
13
|
# @param cast [Boolean]
|
14
|
+
# @param read_only [Boolean]
|
15
|
+
# @param as [String, Symbol, NilClass]
|
13
16
|
# @param dynamic_options [Hash<Symbol,Any>]
|
14
17
|
# @return [SmartCore::Initializer::Attribute]
|
15
18
|
#
|
16
19
|
# @api private
|
17
20
|
# @since 0.1.0
|
18
|
-
def create(name, type, type_system, privacy, finalize, cast, dynamic_options)
|
21
|
+
def create(name, type, type_system, privacy, finalize, cast, read_only, as, dynamic_options)
|
19
22
|
prepared_name = prepare_name_param(name)
|
20
23
|
prepared_privacy = prepare_privacy_param(privacy)
|
21
24
|
prepared_finalize = prepare_finalize_param(finalize)
|
22
25
|
prepared_cast = prepare_cast_param(cast)
|
23
26
|
prepared_type_system = prepare_type_system_param(type_system)
|
24
27
|
prepared_type = prepare_type_param(type, prepared_type_system)
|
28
|
+
prepared_read_only = prepare_read_only_param(read_only)
|
29
|
+
prepared_as = preapre_as_param(as)
|
25
30
|
prepared_dynamic_options = prepare_dynamic_options_param(dynamic_options)
|
26
31
|
|
27
32
|
create_attribute(
|
@@ -31,6 +36,8 @@ class SmartCore::Initializer::Attribute::Factory
|
|
31
36
|
prepared_privacy,
|
32
37
|
prepared_finalize,
|
33
38
|
prepared_cast,
|
39
|
+
prepared_read_only,
|
40
|
+
prepared_as,
|
34
41
|
prepared_dynamic_options
|
35
42
|
)
|
36
43
|
end
|
@@ -118,6 +125,36 @@ class SmartCore::Initializer::Attribute::Factory
|
|
118
125
|
SmartCore::Initializer::Attribute::Finalizer.create(finalize)
|
119
126
|
end
|
120
127
|
|
128
|
+
# @param read_only [Boolean]
|
129
|
+
# @return [Boolean]
|
130
|
+
#
|
131
|
+
# @api private
|
132
|
+
# @since 0.4.0
|
133
|
+
def prepare_read_only_param(read_only)
|
134
|
+
unless read_only.is_a?(FalseClass) || read_only.is_a?(TrueClass)
|
135
|
+
raise(SmartCore::Initializer::ArgumentError, <<~ERROR_MESSAGE)
|
136
|
+
:read_only attribute should be a type of boolean
|
137
|
+
ERROR_MESSAGE
|
138
|
+
end
|
139
|
+
|
140
|
+
read_only
|
141
|
+
end
|
142
|
+
|
143
|
+
# @param [String, Symbol, NilClass]
|
144
|
+
# @return [String, Symbol, NilClass]
|
145
|
+
#
|
146
|
+
# @api private
|
147
|
+
# @since 0.4.0
|
148
|
+
def preapre_as_param(as)
|
149
|
+
unless as.is_a?(NilClass) || as.is_a?(String) || as.is_a?(Symbol)
|
150
|
+
raise(SmartCore::Initializer::ArgumentError, <<~ERROR_MESSAGE)
|
151
|
+
Attribute alias should be a type of String or Symbol
|
152
|
+
ERROR_MESSAGE
|
153
|
+
end
|
154
|
+
|
155
|
+
as
|
156
|
+
end
|
157
|
+
|
121
158
|
# @param dynamic_options [Hash<Symbol,Any>]
|
122
159
|
# @return [Hash<Symbol,Any>]
|
123
160
|
#
|
@@ -155,10 +192,13 @@ class SmartCore::Initializer::Attribute::Factory
|
|
155
192
|
#
|
156
193
|
# @api private
|
157
194
|
# @since 0.1.0
|
158
|
-
|
195
|
+
# rubocop:disable Layout/LineLength
|
196
|
+
def create_attribute(name, type, type_system, privacy, finalize, cast, read_only, as, dynamic_options)
|
159
197
|
SmartCore::Initializer::Attribute.new(
|
160
|
-
name, type, type_system, privacy, finalize, cast, dynamic_options
|
198
|
+
name, type, type_system, privacy, finalize, cast, read_only, as, dynamic_options
|
161
199
|
)
|
162
200
|
end
|
201
|
+
# rubocop:enable Layout/LineLength
|
163
202
|
end
|
164
203
|
end
|
204
|
+
# rubocop:enable Metrics/ClassLength
|
@@ -37,6 +37,18 @@ class SmartCore::Initializer::Attribute::Parameters
|
|
37
37
|
# @since 0.1.0
|
38
38
|
DEFAULT_DYNAMIC_OPTIONS = {}.freeze
|
39
39
|
|
40
|
+
# @return [Boolean]
|
41
|
+
#
|
42
|
+
# @api private
|
43
|
+
# @since 0.4.0
|
44
|
+
DEFAULT_READ_ONLY = true
|
45
|
+
|
46
|
+
# @return [NilClass]
|
47
|
+
#
|
48
|
+
# @api private
|
49
|
+
# @since 0.4.0
|
50
|
+
DEFAULT_AS = nil
|
51
|
+
|
40
52
|
# @return [Symbol]
|
41
53
|
#
|
42
54
|
# @api private
|
@@ -81,25 +93,42 @@ class SmartCore::Initializer::Attribute::Parameters
|
|
81
93
|
# @since 0.1.0
|
82
94
|
attr_reader :dynamic_options
|
83
95
|
|
96
|
+
# @return [Boolean]
|
97
|
+
#
|
98
|
+
# @api private
|
99
|
+
# @since 0.4.0
|
100
|
+
attr_reader :read_only
|
101
|
+
|
102
|
+
# @return [String, Symbol, NilClass]
|
103
|
+
#
|
104
|
+
# @api private
|
105
|
+
# @since 0.4.0
|
106
|
+
attr_reader :as
|
107
|
+
|
84
108
|
# @param name [Symbol]
|
85
109
|
# @param type [SmartCore::Initializer::TypeSystem::Interop]
|
86
110
|
# @param type_system [Class<SmartCore::Initializer::TypeSystem::Interop>]
|
87
111
|
# @param privacy [Symbol]
|
88
112
|
# @param finalizer [SmartCore::Initializer::Attribute::AnonymousBlock/InstanceMethod]
|
89
113
|
# @param cast [Boolean]
|
114
|
+
# @param read_only [Boolean]
|
115
|
+
# @param as [NilClass, Symbol, String]
|
90
116
|
# @param dynamic_options [Hash<Symbol,Any>]
|
91
117
|
# - :default - default value (Proc value will be called)
|
92
118
|
# @return [void]
|
93
119
|
#
|
94
120
|
# @api private
|
95
121
|
# @since 0.1.0
|
96
|
-
|
122
|
+
# @version 0.4.0
|
123
|
+
def initialize(name, type, type_system, privacy, finalizer, cast, read_only, as, dynamic_options)
|
97
124
|
@name = name
|
98
125
|
@type = type
|
99
126
|
@type_system = type_system
|
100
127
|
@privacy = privacy
|
101
128
|
@finalizer = finalizer
|
102
129
|
@cast = cast
|
130
|
+
@read_only = read_only
|
131
|
+
@as = as
|
103
132
|
@dynamic_options = dynamic_options
|
104
133
|
end
|
105
134
|
|
@@ -31,12 +31,24 @@ class SmartCore::Initializer::Constructor::Definer
|
|
31
31
|
# @param privacy [String, Symbol]
|
32
32
|
# @param finalize [String, Symbol, Proc]
|
33
33
|
# @param cast [Boolean]
|
34
|
+
# @param read_only [Boolean]
|
35
|
+
# @param as [String, Symbol, NilClass]
|
34
36
|
# @param dynamic_options [Hash<Symbol,Any>]
|
35
37
|
# @return [void]
|
36
38
|
#
|
37
39
|
# @api private
|
38
40
|
# @since 0.1.0
|
39
|
-
def define_parameter(
|
41
|
+
def define_parameter(
|
42
|
+
name,
|
43
|
+
type,
|
44
|
+
type_system,
|
45
|
+
privacy,
|
46
|
+
finalize,
|
47
|
+
cast,
|
48
|
+
read_only,
|
49
|
+
as,
|
50
|
+
dynamic_options
|
51
|
+
)
|
40
52
|
thread_safe do
|
41
53
|
attribute = build_attribute(
|
42
54
|
name,
|
@@ -45,6 +57,8 @@ class SmartCore::Initializer::Constructor::Definer
|
|
45
57
|
privacy,
|
46
58
|
finalize,
|
47
59
|
cast,
|
60
|
+
read_only,
|
61
|
+
as,
|
48
62
|
dynamic_options
|
49
63
|
)
|
50
64
|
prevent_option_overlap(attribute)
|
@@ -67,6 +81,8 @@ class SmartCore::Initializer::Constructor::Definer
|
|
67
81
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_PRIVACY_MODE,
|
68
82
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_FINALIZER,
|
69
83
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_CAST_BEHAVIOUR,
|
84
|
+
SmartCore::Initializer::Attribute::Parameters::DEFAULT_READ_ONLY,
|
85
|
+
SmartCore::Initializer::Attribute::Parameters::DEFAULT_AS,
|
70
86
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_DYNAMIC_OPTIONS.dup
|
71
87
|
).tap do |attribute|
|
72
88
|
prevent_option_overlap(attribute)
|
@@ -83,12 +99,24 @@ class SmartCore::Initializer::Constructor::Definer
|
|
83
99
|
# @param privacy [String, Symbol]
|
84
100
|
# @param finalize [String, Symbol, Proc]
|
85
101
|
# @param cast [Boolean]
|
102
|
+
# @param read_only [Boolean]
|
103
|
+
# @param as [String, Symbol, NilClass]
|
86
104
|
# @param dynamic_options [Hash<Symbol,Any>]
|
87
105
|
# @return [void]
|
88
106
|
#
|
89
107
|
# @api private
|
90
108
|
# @since 0.1.0
|
91
|
-
def define_option(
|
109
|
+
def define_option(
|
110
|
+
name,
|
111
|
+
type,
|
112
|
+
type_system,
|
113
|
+
privacy,
|
114
|
+
finalize,
|
115
|
+
cast,
|
116
|
+
read_only,
|
117
|
+
as,
|
118
|
+
dynamic_options
|
119
|
+
)
|
92
120
|
thread_safe do
|
93
121
|
attribute = build_attribute(
|
94
122
|
name,
|
@@ -97,6 +125,8 @@ class SmartCore::Initializer::Constructor::Definer
|
|
97
125
|
privacy,
|
98
126
|
finalize,
|
99
127
|
cast,
|
128
|
+
read_only,
|
129
|
+
as,
|
100
130
|
dynamic_options
|
101
131
|
)
|
102
132
|
prevent_parameter_overlap(attribute)
|
@@ -119,6 +149,8 @@ class SmartCore::Initializer::Constructor::Definer
|
|
119
149
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_PRIVACY_MODE,
|
120
150
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_FINALIZER,
|
121
151
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_CAST_BEHAVIOUR,
|
152
|
+
SmartCore::Initializer::Attribute::Parameters::DEFAULT_READ_ONLY,
|
153
|
+
SmartCore::Initializer::Attribute::Parameters::DEFAULT_AS,
|
122
154
|
SmartCore::Initializer::Attribute::Parameters::DEFAULT_DYNAMIC_OPTIONS.dup
|
123
155
|
).tap do |attribute|
|
124
156
|
prevent_parameter_overlap(attribute)
|
@@ -143,14 +175,26 @@ class SmartCore::Initializer::Constructor::Definer
|
|
143
175
|
# @param privacy [String, Symbol]
|
144
176
|
# @param finalize [String, Symbol, Proc]
|
145
177
|
# @param cast [Boolean]
|
178
|
+
# @param read_only [Boolean]
|
179
|
+
# @param as [String, Symbol, NilClass]
|
146
180
|
# @param dynamic_options [Hash<Symbol,Any>]
|
147
181
|
# @return [SmartCore::Initializer::Attribute]
|
148
182
|
#
|
149
183
|
# @api private
|
150
184
|
# @since 0.1.0
|
151
|
-
def build_attribute(
|
185
|
+
def build_attribute(
|
186
|
+
name,
|
187
|
+
type,
|
188
|
+
type_system,
|
189
|
+
privacy,
|
190
|
+
finalize,
|
191
|
+
cast,
|
192
|
+
read_only,
|
193
|
+
as,
|
194
|
+
dynamic_options
|
195
|
+
)
|
152
196
|
SmartCore::Initializer::Attribute::Factory.create(
|
153
|
-
name, type, type_system, privacy, finalize, cast, dynamic_options
|
197
|
+
name, type, type_system, privacy, finalize, cast, read_only, as, dynamic_options
|
154
198
|
)
|
155
199
|
end
|
156
200
|
|
@@ -77,7 +77,7 @@ module SmartCore::Initializer::DSL
|
|
77
77
|
@__init_extensions__
|
78
78
|
end
|
79
79
|
|
80
|
-
# @return [SmartCore::Initializer::
|
80
|
+
# @return [SmartCore::Initializer::Constructor::Definer]
|
81
81
|
#
|
82
82
|
# @api private
|
83
83
|
# @since 0.1.0
|
@@ -108,11 +108,14 @@ module SmartCore::Initializer::DSL
|
|
108
108
|
# @option cast [Boolean]
|
109
109
|
# @option privacy [String, Symbol]
|
110
110
|
# @option finalize [String, Symbol, Proc]
|
111
|
+
# @option read_only [Boolean]
|
112
|
+
# @option as [NilClass, String, Symbol]
|
111
113
|
# @param dynamic_options [Hash<Symbol,Any>]
|
112
114
|
# @return [void]
|
113
115
|
#
|
114
116
|
# @api public
|
115
117
|
# @since 0.1.0
|
118
|
+
# @version 0.4.0
|
116
119
|
def param(
|
117
120
|
name,
|
118
121
|
type = __initializer_settings__.generic_type_object,
|
@@ -120,10 +123,12 @@ module SmartCore::Initializer::DSL
|
|
120
123
|
finalize: SmartCore::Initializer::Attribute::Parameters::DEFAULT_FINALIZER,
|
121
124
|
cast: SmartCore::Initializer::Attribute::Parameters::DEFAULT_CAST_BEHAVIOUR,
|
122
125
|
type_system: __initializer_settings__.type_system,
|
126
|
+
read_only: SmartCore::Initializer::Attribute::Parameters::DEFAULT_READ_ONLY,
|
127
|
+
as: SmartCore::Initializer::Attribute::Parameters::DEFAULT_AS,
|
123
128
|
**dynamic_options
|
124
129
|
)
|
125
130
|
__definer__.define_parameter(
|
126
|
-
name, type, type_system, privacy, finalize, cast, dynamic_options
|
131
|
+
name, type, type_system, privacy, finalize, cast, read_only, as, dynamic_options
|
127
132
|
)
|
128
133
|
end
|
129
134
|
|
@@ -142,11 +147,14 @@ module SmartCore::Initializer::DSL
|
|
142
147
|
# @option privacy [String, Symbol]
|
143
148
|
# @option finalize [String, Symbol, Proc]
|
144
149
|
# @option type_system [String, Symbol]
|
150
|
+
# @option read_only [Boolean]
|
151
|
+
# @option as [NilClass, String, Symbol]
|
145
152
|
# @param dynamic_options [Hash<Symbol,Any>]
|
146
153
|
# @return [void]
|
147
154
|
#
|
148
155
|
# @api public
|
149
156
|
# @since 0.1.0
|
157
|
+
# @version 0.4.0
|
150
158
|
def option(
|
151
159
|
name,
|
152
160
|
type = __initializer_settings__.generic_type_object,
|
@@ -154,10 +162,12 @@ module SmartCore::Initializer::DSL
|
|
154
162
|
finalize: SmartCore::Initializer::Attribute::Parameters::DEFAULT_FINALIZER,
|
155
163
|
cast: SmartCore::Initializer::Attribute::Parameters::DEFAULT_CAST_BEHAVIOUR,
|
156
164
|
type_system: __initializer_settings__.type_system,
|
165
|
+
read_only: SmartCore::Initializer::Attribute::Parameters::DEFAULT_READ_ONLY,
|
166
|
+
as: SmartCore::Initializer::Attribute::Parameters::DEFAULT_AS,
|
157
167
|
**dynamic_options
|
158
168
|
)
|
159
169
|
__definer__.define_option(
|
160
|
-
name, type, type_system, privacy, finalize, cast, dynamic_options
|
170
|
+
name, type, type_system, privacy, finalize, cast, read_only, as, dynamic_options
|
161
171
|
)
|
162
172
|
end
|
163
173
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
module SmartCore::Initializer::Plugins
|
6
6
|
require_relative 'plugins/abstract'
|
7
7
|
require_relative 'plugins/registry'
|
8
|
-
require_relative 'plugins/registry_interface
|
8
|
+
require_relative 'plugins/registry_interface'
|
9
9
|
require_relative 'plugins/access_mixin'
|
10
10
|
require_relative 'plugins/thy_types'
|
11
11
|
|
data/smart_initializer.gemspec
CHANGED
@@ -30,13 +30,14 @@ 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.
|
34
|
-
spec.add_dependency 'smart_types', '~> 0.1
|
33
|
+
spec.add_dependency 'smart_engine', '~> 0.11'
|
34
|
+
spec.add_dependency 'smart_types', '~> 0.1'
|
35
35
|
spec.add_dependency 'qonfig', '~> 0.24'
|
36
36
|
|
37
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
37
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
40
|
-
spec.add_development_dependency 'armitage-rubocop', '~>
|
41
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
40
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 1.7'
|
41
|
+
spec.add_development_dependency 'simplecov', '~> 0.21'
|
42
|
+
spec.add_development_dependency 'pry', '~> 0.13'
|
42
43
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smart_engine
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.11'
|
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.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: smart_types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1
|
33
|
+
version: '0.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1
|
40
|
+
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: qonfig
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2.
|
68
|
+
version: '2.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,42 +86,56 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.10'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: armitage-rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1.7'
|
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: '
|
110
|
+
version: '1.7'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0.
|
117
|
+
version: '0.21'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0.
|
124
|
+
version: '0.21'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.13'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.13'
|
125
139
|
description: A simple and convenient way to declare complex constructors
|
126
140
|
email:
|
127
141
|
- iamdaiver@gmail.com
|
@@ -132,7 +146,6 @@ files:
|
|
132
146
|
- ".gitignore"
|
133
147
|
- ".rspec"
|
134
148
|
- ".rubocop.yml"
|
135
|
-
- ".travis.yml"
|
136
149
|
- CHANGELOG.md
|
137
150
|
- CODE_OF_CONDUCT.md
|
138
151
|
- Gemfile
|
@@ -209,7 +222,7 @@ metadata:
|
|
209
222
|
homepage_uri: https://github.com/smart-rb/smart_initializer
|
210
223
|
source_code_uri: https://github.com/smart-rb/smart_initializer
|
211
224
|
changelog_uri: https://github.com/smart-rb/smart_initializer/blob/master/CHANGELOG.md
|
212
|
-
post_install_message:
|
225
|
+
post_install_message:
|
213
226
|
rdoc_options: []
|
214
227
|
require_paths:
|
215
228
|
- lib
|
@@ -224,8 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
237
|
- !ruby/object:Gem::Version
|
225
238
|
version: '0'
|
226
239
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
228
|
-
signing_key:
|
240
|
+
rubygems_version: 3.2.3
|
241
|
+
signing_key:
|
229
242
|
specification_version: 4
|
230
243
|
summary: Initializer DSL
|
231
244
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
os: linux
|
5
|
-
dist: xenial
|
6
|
-
before_install: gem install bundler
|
7
|
-
script:
|
8
|
-
- bundle exec rake rubocop
|
9
|
-
- bundle exec rake rspec
|
10
|
-
jobs:
|
11
|
-
fast_finish: true
|
12
|
-
include:
|
13
|
-
- rvm: 2.4.10
|
14
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
15
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
16
|
-
- rvm: 2.5.8
|
17
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
18
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
19
|
-
- rvm: 2.6.6
|
20
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
21
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
22
|
-
- rvm: 2.7.1
|
23
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
24
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
25
|
-
- rvm: ruby-head
|
26
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
27
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
28
|
-
- rvm: jruby-head
|
29
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
30
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
31
|
-
- rvm: truffleruby
|
32
|
-
gemfile: gemfiles/with_external_deps.gemfile
|
33
|
-
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
34
|
-
- rvm: 2.4.10
|
35
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
36
|
-
- rvm: 2.5.8
|
37
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
38
|
-
- rvm: 2.6.6
|
39
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
40
|
-
- rvm: 2.7.1
|
41
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
42
|
-
- rvm: ruby-head
|
43
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
44
|
-
- rvm: jruby-head
|
45
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
46
|
-
- rvm: truffleruby
|
47
|
-
gemfile: gemfiles/without_external_deps.gemfile
|
48
|
-
allow_failures:
|
49
|
-
- rvm: ruby-head
|
50
|
-
- rvm: jruby-head
|
51
|
-
- rvm: truffleruby
|