u-struct 1.0.0 → 1.1.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 +4 -4
- data/.github/workflows/ci.yml +5 -5
- data/.rubocop.yml +129 -0
- data/.rubocop_todo.yml +10 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +115 -27
- data/Gemfile +14 -3
- data/README.md +166 -62
- data/Rakefile +5 -5
- data/bin/console +3 -3
- data/bin/prepare_coverage +7 -9
- data/bin/run_ci +17 -0
- data/bin/tapioca +28 -0
- data/examples/rgb/number.rb +1 -1
- data/examples/rgb_1.rb +3 -3
- data/examples/rgb_2.rb +2 -2
- data/examples/rgb_3.rb +1 -1
- data/lib/micro/struct/factory/create_struct.rb +12 -5
- data/lib/micro/struct/factory/members.rb +1 -0
- data/lib/micro/struct/factory.rb +10 -5
- data/lib/micro/struct/features.rb +18 -23
- data/lib/micro/struct/normalize_names.rb +4 -3
- data/lib/micro/struct/version.rb +2 -1
- data/lib/micro/struct.rb +32 -5
- data/lib/u-struct.rb +2 -0
- data/rbi/micro/struct/factory/create_struct.rbi +60 -0
- data/rbi/micro/struct/factory/members.rbi +67 -0
- data/rbi/micro/struct/factory.rbi +41 -0
- data/rbi/micro/struct/features.rbi +41 -0
- data/rbi/micro/struct/normalize_names.rbi +20 -0
- data/rbi/micro/struct/version.rbi +3 -0
- data/rbi/micro/struct.rbi +68 -0
- data/sorbet/config +8 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +54 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +11 -0
- data/sorbet/rbi/gems/docile@1.4.0.rbi +54 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/minitest@5.15.0.rbi +345 -0
- data/sorbet/rbi/gems/parser@3.1.0.0.rbi +1196 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +806 -0
- data/sorbet/rbi/gems/rbi@0.0.9.rbi +1602 -0
- data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +89 -0
- data/sorbet/rbi/gems/simplecov@0.21.2.rbi +577 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +8 -0
- data/sorbet/rbi/gems/spoom@1.1.8.rbi +1252 -0
- data/sorbet/rbi/gems/tapioca@0.6.2.rbi +1232 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +844 -0
- data/sorbet/rbi/gems/unparser@0.6.3.rbi +8 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +601 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +199 -0
- data/sorbet/rbi/gems/yard@0.9.27.rbi +4112 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- data/u-struct.gemspec +3 -3
- metadata +37 -3
- data/bin/test +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa40551d175dd0f2239b9c8a5c7fda5ea39e29b4293c23d8318744cf2f9df0b9
|
4
|
+
data.tar.gz: 5f5058d00fde571ed7fb972dd976dcae1dbe5e7469c2f069eeb29b6cdd01747a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef1569d45a887c42dd1239a35a98fdb160c6d93ca5e6cd24cbac1f4763295ff4228c5343f64fdf33e91a51503597b66aa0222b0652fd7b723d2e35e3a3c2e4ca
|
7
|
+
data.tar.gz: 7c2747b2b46095461d6402a1a7f58d4a2b4b8396572c4e6bb7d36e986da1aec44a17f82603ec2c01bd62bbbe3a6127114a8023b6e04e0601df8be045daae9699
|
data/.github/workflows/ci.yml
CHANGED
@@ -6,20 +6,20 @@ jobs:
|
|
6
6
|
runs-on: ubuntu-latest
|
7
7
|
strategy:
|
8
8
|
matrix:
|
9
|
-
ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1
|
9
|
+
ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0.3, 3.1]
|
10
10
|
steps:
|
11
11
|
- uses: actions/checkout@v2
|
12
12
|
- uses: ruby/setup-ruby@v1
|
13
13
|
with:
|
14
14
|
ruby-version: ${{ matrix.ruby }}
|
15
15
|
bundler-cache: true
|
16
|
-
- name:
|
17
|
-
run: bin/
|
16
|
+
- name: Run sorbet, rubocop, tests and generate code coverage
|
17
|
+
run: bin/run_ci
|
18
18
|
- name: Format coverage
|
19
|
-
if: ${{ matrix.ruby >= 3
|
19
|
+
if: ${{ matrix.ruby >= 3.1 }}
|
20
20
|
run: bin/prepare_coverage
|
21
21
|
- uses: paambaati/codeclimate-action@v2.7.5
|
22
|
-
if: ${{ matrix.ruby >= 3
|
22
|
+
if: ${{ matrix.ruby >= 3.1 }}
|
23
23
|
env:
|
24
24
|
CC_TEST_REPORTER_ID: 8ce350edeb0772e94ffd678bbaca30d9c1293b9d9051a1689c79b91c21f5afd5
|
25
25
|
with:
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
4
|
+
# configuration file. It makes it possible to enable/disable
|
5
|
+
# certain cops (checks) and to alter their behavior if they accept
|
6
|
+
# any parameters. The file can be placed either in your home
|
7
|
+
# directory or in some project directory.
|
8
|
+
#
|
9
|
+
# RuboCop will start looking for the configuration file in the directory
|
10
|
+
# where the inspected file is and continue its way up to the root directory.
|
11
|
+
#
|
12
|
+
# See https://docs.rubocop.org/rubocop/configuration
|
13
|
+
|
14
|
+
require:
|
15
|
+
- rubocop-rake
|
16
|
+
- rubocop-minitest
|
17
|
+
|
18
|
+
AllCops:
|
19
|
+
NewCops: enable
|
20
|
+
TargetRubyVersion: 2.5
|
21
|
+
|
22
|
+
# == Gemspec ==
|
23
|
+
|
24
|
+
Gemspec/RequiredRubyVersion:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
# == Style ==
|
28
|
+
|
29
|
+
Style/Alias:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/CaseEquality:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/ClassAndModuleChildren:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Style/CombinableLoops:
|
39
|
+
Exclude:
|
40
|
+
- test/**/*.rb
|
41
|
+
|
42
|
+
Style/Documentation:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/FormatStringToken:
|
46
|
+
EnforcedStyle: annotated
|
47
|
+
|
48
|
+
Style/Lambda:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/LambdaCall:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/ModuleFunction:
|
55
|
+
EnforcedStyle: extend_self
|
56
|
+
|
57
|
+
Style/RaiseArgs:
|
58
|
+
EnforcedStyle: compact
|
59
|
+
|
60
|
+
Style/SymbolArray:
|
61
|
+
EnforcedStyle: brackets
|
62
|
+
|
63
|
+
# == Layout ==
|
64
|
+
|
65
|
+
Layout/ArrayAlignment:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Layout/ExtraSpacing:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Layout/HashAlignment:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Layout/SpaceAroundOperators:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
78
|
+
EnforcedStyle: no_space
|
79
|
+
EnforcedStyleForEmptyBrackets: no_space
|
80
|
+
|
81
|
+
Layout/SpaceInsideHashLiteralBraces:
|
82
|
+
EnforcedStyle: no_space
|
83
|
+
|
84
|
+
# == Lint ==
|
85
|
+
|
86
|
+
Lint/ConstantDefinitionInBlock:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
Lint/NestedMethodDefinition:
|
90
|
+
Exclude:
|
91
|
+
- test/micro/struct/instance_method_test.rb
|
92
|
+
|
93
|
+
# == Naming ==
|
94
|
+
|
95
|
+
Naming/ClassAndModuleCamelCase:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Naming/FileName:
|
99
|
+
Exclude:
|
100
|
+
- lib/u-struct.rb
|
101
|
+
|
102
|
+
Naming/MethodParameterName:
|
103
|
+
Exclude:
|
104
|
+
- examples/**/*.rb
|
105
|
+
|
106
|
+
Naming/RescuedExceptionsVariableName:
|
107
|
+
PreferredName: exception
|
108
|
+
|
109
|
+
# == Metrics ==
|
110
|
+
|
111
|
+
Metrics/AbcSize:
|
112
|
+
Exclude:
|
113
|
+
- test/**/*.rb
|
114
|
+
|
115
|
+
Metrics/MethodLength:
|
116
|
+
Exclude:
|
117
|
+
- test/**/*.rb
|
118
|
+
|
119
|
+
Metrics/ClassLength:
|
120
|
+
Exclude:
|
121
|
+
- test/**/*.rb
|
122
|
+
|
123
|
+
# == Minitest ==
|
124
|
+
|
125
|
+
Minitest/AssertWithExpectedArgument:
|
126
|
+
Enabled: false
|
127
|
+
|
128
|
+
Minitest/MultipleAssertions:
|
129
|
+
Max: 21
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-01-27 11:53:52 UTC using RuboCop version 1.25.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
Gemspec/RequireMFA:
|
10
|
+
Enabled: false
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.1.0
|
data/CHANGELOG.md
CHANGED
@@ -6,47 +6,111 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
8
|
- [[Unreleased]](#unreleased)
|
9
|
-
- [[
|
9
|
+
- [[1.1.0] - 2021-03-23](#110---2021-03-23)
|
10
10
|
- [Added](#added)
|
11
|
-
- [[0.
|
11
|
+
- [[1.0.0] - 2021-01-19](#100---2021-01-19)
|
12
|
+
- [[0.12.0] - 2021-12-22](#0120---2021-12-22)
|
12
13
|
- [Added](#added-1)
|
14
|
+
- [[0.11.0] - 2021-12-19](#0110---2021-12-19)
|
15
|
+
- [Added](#added-2)
|
13
16
|
- [[0.10.0] - 2021-12-15](#0100---2021-12-15)
|
14
17
|
- [Changed](#changed)
|
15
18
|
- [[0.9.0] - 2021-12-14](#090---2021-12-14)
|
16
|
-
- [Added](#added-
|
19
|
+
- [Added](#added-3)
|
17
20
|
- [Changed](#changed-1)
|
18
21
|
- [[0.8.0] - 2021-12-05](#080---2021-12-05)
|
19
|
-
- [Added](#added-3)
|
20
|
-
- [[0.7.0] - 2021-12-04](#070---2021-12-04)
|
21
22
|
- [Added](#added-4)
|
23
|
+
- [[0.7.0] - 2021-12-04](#070---2021-12-04)
|
24
|
+
- [Added](#added-5)
|
22
25
|
- [Changed](#changed-2)
|
23
26
|
- [[0.6.0] - 2021-12-03](#060---2021-12-03)
|
24
|
-
- [Added](#added-5)
|
25
|
-
- [[0.5.0] - 2021-12-02](#050---2021-12-02)
|
26
27
|
- [Added](#added-6)
|
27
|
-
- [[0.
|
28
|
+
- [[0.5.0] - 2021-12-02](#050---2021-12-02)
|
28
29
|
- [Added](#added-7)
|
30
|
+
- [[0.4.0] - 2021-12-02](#040---2021-12-02)
|
31
|
+
- [Added](#added-8)
|
29
32
|
- [[0.3.1] - 2021-12-02](#031---2021-12-02)
|
30
33
|
- [Fixed](#fixed)
|
31
34
|
- [[0.3.0] - 2021-12-02](#030---2021-12-02)
|
32
|
-
- [Added](#added-8)
|
33
|
-
- [[0.2.0] - 2021-12-02](#020---2021-12-02)
|
34
35
|
- [Added](#added-9)
|
35
|
-
- [[0.
|
36
|
+
- [[0.2.0] - 2021-12-02](#020---2021-12-02)
|
36
37
|
- [Added](#added-10)
|
37
|
-
|
38
|
+
- [[0.1.0] - 2021-12-02](#010---2021-12-02)
|
39
|
+
- [Added](#added-11)
|
38
40
|
## [Unreleased]
|
39
41
|
|
40
|
-
[
|
42
|
+
[Diff](https://github.com/serradura/u-struct/compare/v1.1.0...main)
|
43
|
+
|
44
|
+
## [1.1.0] - 2021-03-23
|
45
|
+
|
46
|
+
[Diff](https://github.com/serradura/u-struct/compare/v1.0.0...v1.1.0) | [Tag](https://github.com/serradura/u-struct/tree/v1.1.0)
|
47
|
+
### Added
|
48
|
+
|
49
|
+
- Add `Micro::Struct[]` as an alias of `Micro::Struct.with`.
|
50
|
+
```ruby
|
51
|
+
Micro::Struct[:readonly] # is the same as Micro::Struct.with(:readonly)
|
52
|
+
```
|
53
|
+
|
54
|
+
- Add `Micro::Struct.immutable` method as a shortcut to `Micro::Struct.with(:readonly, :instance_copy)`.
|
55
|
+
It also accepts the `with:` option, which can be used to define additional features.
|
56
|
+
```ruby
|
57
|
+
Micro::Struct.immutable.new(:name)
|
58
|
+
|
59
|
+
Micro::Struct.immutable.new(:name) do
|
60
|
+
def hi(other_name)
|
61
|
+
"Hi, #{other_name}! My name is #{name}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
Micro::Struct.immutable(with: :to_hash).new(:name)
|
66
|
+
|
67
|
+
Micro::Struct.immutable(with: [:to_hash, :to_proc]).new(:name)
|
68
|
+
|
69
|
+
Micro::Struct.immutable.instance(name: 'Rodrigo')
|
70
|
+
|
71
|
+
Micro::Struct.immutable(with: [:to_hash]).instance(name: 'Serradura')
|
72
|
+
```
|
73
|
+
|
74
|
+
- Add `Micro::Struct.readonly` method as a shortcut to `Micro::Struct.with(:readonly)`.
|
75
|
+
It has the same properties of `Micro::Struct.immutable`.
|
76
|
+
```ruby
|
77
|
+
Micro::Struct.readonly.new(:name)
|
78
|
+
|
79
|
+
Micro::Struct.readonly.new(:name) do
|
80
|
+
def hi(other_name)
|
81
|
+
"Hi, #{other_name}! My name is #{name}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Micro::Struct.readonly(with: :to_hash).new(:name)
|
86
|
+
|
87
|
+
Micro::Struct.readonly(with: [:to_hash, :to_proc]).new(:name)
|
88
|
+
|
89
|
+
Micro::Struct.readonly.instance(name: 'Rodrigo')
|
90
|
+
|
91
|
+
Micro::Struct.readonly(with: [:to_hash]).instance(name: 'Serradura')
|
92
|
+
```
|
93
|
+
**Development stuff**
|
94
|
+
|
95
|
+
- Set up Rubocop.
|
96
|
+
- Add `.rbi` files, and set up sorbet to be used in development.
|
97
|
+
|
98
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
99
|
+
|
100
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
41
101
|
|
42
102
|
## [1.0.0] - 2021-01-19
|
43
103
|
|
104
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.12.0...v1.0.0) | [Tag](https://github.com/serradura/u-struct/tree/v1.0.0)
|
105
|
+
|
44
106
|
- Review and update docs and examples. ;)
|
45
107
|
|
46
|
-
|
108
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
47
109
|
|
48
110
|
## [0.12.0] - 2021-12-22
|
49
111
|
|
112
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.11.0...v0.12.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.12.0)
|
113
|
+
|
50
114
|
### Added
|
51
115
|
|
52
116
|
- Add `Micro::Struct.instance` to create a struct instance from a given hash.
|
@@ -115,20 +179,24 @@ Person.features.options?(:to_proc, :readonly) # => true
|
|
115
179
|
Person.features.options?(:to_ary, :readonly) # => false
|
116
180
|
```
|
117
181
|
|
118
|
-
|
182
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
119
183
|
|
120
184
|
## [0.11.0] - 2021-12-19
|
121
185
|
|
186
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.10.0...v0.11.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.11.0)
|
187
|
+
|
122
188
|
### Added
|
123
189
|
|
124
190
|
- Reduce the required Ruby version to `>= 2.2.0`.
|
125
191
|
- Set up a CI with Github actions.
|
126
192
|
- Test the codebase against the Ruby versions: `2.2`, `2.3`, `2.4`, `2.5`, `2.6`, `2.7`, `3.0` and `3.1.0-preview1`.
|
127
193
|
|
128
|
-
|
194
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
129
195
|
|
130
196
|
## [0.10.0] - 2021-12-15
|
131
197
|
|
198
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.9.0...v0.10.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.10.0)
|
199
|
+
|
132
200
|
### Changed
|
133
201
|
|
134
202
|
- Make `Micro::Struct.new` return a Ruby struct instead of a module.
|
@@ -159,10 +227,12 @@ rgb_color.to_hex
|
|
159
227
|
# => "#0105ff"
|
160
228
|
```
|
161
229
|
|
162
|
-
|
230
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
163
231
|
|
164
232
|
## [0.9.0] - 2021-12-14
|
165
233
|
|
234
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.8.0...v0.9.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.9.0)
|
235
|
+
|
166
236
|
### Added
|
167
237
|
|
168
238
|
- Add `__new__` method and make `.new` its alias. You can use `__new__` when overwriting the module's `new`.
|
@@ -248,10 +318,12 @@ rgb_color.to_ary # => [1, 5, 255]
|
|
248
318
|
rgb_color.to_hash # => {:r=>1, :g=>5, :b=>255}
|
249
319
|
```
|
250
320
|
|
251
|
-
|
321
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
252
322
|
|
253
323
|
## [0.8.0] - 2021-12-05
|
254
324
|
|
325
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.7.0...v0.8.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.8.0)
|
326
|
+
|
255
327
|
### Added
|
256
328
|
|
257
329
|
- Add `.===` to the module, it delegates the calling to its struct.
|
@@ -266,10 +338,12 @@ Person === person
|
|
266
338
|
# => true
|
267
339
|
```
|
268
340
|
|
269
|
-
|
341
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
270
342
|
|
271
343
|
## [0.7.0] - 2021-12-04
|
272
344
|
|
345
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.6.0...v0.7.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.7.0)
|
346
|
+
|
273
347
|
### Added
|
274
348
|
|
275
349
|
- Add `required:` option to define required struct members.
|
@@ -295,10 +369,12 @@ Person = Micro::Struct.new(
|
|
295
369
|
)
|
296
370
|
```
|
297
371
|
|
298
|
-
|
372
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
299
373
|
|
300
374
|
## [0.6.0] - 2021-12-03
|
301
375
|
|
376
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.5.0...v0.6.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.6.0)
|
377
|
+
|
302
378
|
### Added
|
303
379
|
|
304
380
|
- Add the capability to create a struct with optional members.
|
@@ -320,10 +396,12 @@ Persona.new
|
|
320
396
|
# => #<struct Persona::Struct first_name=nil, last_name=nil>
|
321
397
|
```
|
322
398
|
|
323
|
-
|
399
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
324
400
|
|
325
401
|
## [0.5.0] - 2021-12-02
|
326
402
|
|
403
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.4.0...v0.5.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.5.0)
|
404
|
+
|
327
405
|
### Added
|
328
406
|
|
329
407
|
- Add new feature `:instance_copy`. It instantiates a struct of the same kind from its current state.
|
@@ -371,10 +449,12 @@ person.name # => "Rodrigo Serradura"
|
|
371
449
|
new_person.name # => "John Doe"
|
372
450
|
```
|
373
451
|
|
374
|
-
|
452
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
375
453
|
|
376
454
|
## [0.4.0] - 2021-12-02
|
377
455
|
|
456
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.3.1...v0.4.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.4.0)
|
457
|
+
|
378
458
|
### Added
|
379
459
|
|
380
460
|
- Add `.members` to the module, it delegates the calling to its struct.
|
@@ -400,26 +480,32 @@ person.respond_to?(:to_hash) # => false
|
|
400
480
|
Person.respond_to?(:to_proc) # => false
|
401
481
|
```
|
402
482
|
|
403
|
-
|
483
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
404
484
|
|
405
485
|
## [0.3.1] - 2021-12-02
|
406
486
|
|
487
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.3.0...v0.3.1) | [Tag](https://github.com/serradura/u-struct/tree/v0.3.1)
|
488
|
+
|
407
489
|
### Fixed
|
408
490
|
|
409
491
|
- Fix the spec.files config of `u-struct.gemspec`.
|
410
492
|
|
411
|
-
|
493
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
412
494
|
|
413
495
|
## [0.3.0] - 2021-12-02
|
414
496
|
|
497
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.2.0...v0.3.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.3.0)
|
498
|
+
|
415
499
|
### Added
|
416
500
|
|
417
501
|
- Add `lib/u-struct.rb` to allow the bundler to require the gem in an automatic way.
|
418
502
|
|
419
|
-
|
503
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
420
504
|
|
421
505
|
## [0.2.0] - 2021-12-02
|
422
506
|
|
507
|
+
[Diff](https://github.com/serradura/u-struct/compare/v0.1.0...v0.2.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.2.0)
|
508
|
+
|
423
509
|
### Added
|
424
510
|
|
425
511
|
- Add `to_hash` as an alias of Struct's `to_h`.
|
@@ -436,10 +522,12 @@ person = Person.new(first_name: 'Rodrigo', last_name: 'Serradura')
|
|
436
522
|
print_first_and_last_name(**person) # Rodrigo Serradura
|
437
523
|
```
|
438
524
|
|
439
|
-
|
525
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
440
526
|
|
441
527
|
## [0.1.0] - 2021-12-02
|
442
528
|
|
529
|
+
[Diff](https://github.com/serradura/u-struct/compare/19beceb97a9bc22f2a485b82e4002b6a2e20a73c...v0.1.0) | [Tag](https://github.com/serradura/u-struct/tree/v0.1.0)
|
530
|
+
|
443
531
|
### Added
|
444
532
|
|
445
533
|
- Create a module containing a Ruby struct with some custom features.
|
@@ -499,4 +587,4 @@ Person::Struct.new
|
|
499
587
|
# => NoMethodError (private method `new' called for Person::Struct:Class)
|
500
588
|
```
|
501
589
|
|
502
|
-
|
590
|
+
<p align="right">(<a href="#changelog-">⬆️ back to top</a>)</p>
|
data/Gemfile
CHANGED
@@ -5,7 +5,18 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in micro-struct.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'rake', '
|
8
|
+
gem 'rake', '13.0.6'
|
9
9
|
|
10
|
-
gem 'minitest', '
|
11
|
-
|
10
|
+
gem 'minitest', '5.15.0'
|
11
|
+
|
12
|
+
if RUBY_VERSION >= '2.5.0'
|
13
|
+
gem 'rubocop', '1.26'
|
14
|
+
gem 'rubocop-minitest', '0.18.0'
|
15
|
+
gem 'rubocop-rake', '0.6.0'
|
16
|
+
gem 'simplecov', '0.21.2'
|
17
|
+
end
|
18
|
+
|
19
|
+
if RUBY_VERSION >= '2.7.0'
|
20
|
+
gem 'sorbet', '0.5.9775'
|
21
|
+
gem 'tapioca', '0.7.0'
|
22
|
+
end
|