dry-struct 0.6.0 → 1.4.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: 33cd05dd51a3310d7ede685ae1ce8631a0955d7563afca7633a7625b9b34dd17
4
- data.tar.gz: 182c58865ccb3e74595aa22d6c9730ce8ca0e078d1b6ecb5e8b69e026ce6409d
3
+ metadata.gz: bf0892469a434b85578e7350f52039b85203dbd251ca5c4bd6b038373edc703e
4
+ data.tar.gz: 263e3d2d4ce824be64210a27d074fb42126dde12d94e56290307d9ff08c0efad
5
5
  SHA512:
6
- metadata.gz: 3f5e4f6609b93e80ae775ab556812cc872883eaf423a74ae2e5191d2bef6907152653fa7fe441bb9aab945b7cf9f4ec62dd4d359ffcb88f4e976b8b53fb42ac8
7
- data.tar.gz: 4b76e94533ff98f1c1d9d427967a5c19af3d58484a5e785c7eac15d50211d70e4718d35572bb6e89fbafeb9b9f092a73f68e517244676f28d4c7e4854f1a055a
6
+ metadata.gz: '08ea5f7780bac10495f93a5043c5e100fc9386688920e4e7fd1b2304ceaeb8f37853f6ed70f5d5a69b1d7a30c0340450f8ce41fba91e812e00cf6a008f9c2de0'
7
+ data.tar.gz: da176db2c5d8127ea7ef6a088edf7f8f4d18c74e65d96e7f6a80dd9822c0baefdfa1dd7eb6d607ac077c033d64dcddb0ca6c1498eb411c4cd94ea96e23c701b4
data/CHANGELOG.md CHANGED
@@ -1,12 +1,177 @@
1
- # v0.6.0 2018-10-24
1
+ <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
- ## BREAKING CHANGES
3
+ ## 1.4.0 2021-01-21
4
4
 
5
- * `Struct.attribute?` in the old sense is deprecated, use `has_attribute?` as a replacement
6
5
 
7
- ## Added
6
+ ### Added
7
+
8
+ - Support for wrapping constructors and fallbacks, see release notes for dry-types 1.5.0 (@flash-gordon)
9
+ - Improvements of the attribute DSL, now it's possible to use optional structs as a base class (@flash-gordon)
10
+ ```ruby
11
+ class User < Dry::Struct
12
+ attribute :name, Types::String
13
+ attribute :address, Dry::Struct.optional do
14
+ attribute :city, Types::String
15
+ end
16
+ end
17
+
18
+ User.new(name: "John", address: nil) # => #<User name="John" address=nil>
19
+ ```
8
20
 
9
- * `Struct.attribute?` is an easy way to define omittable attributes (flash-gordon):
21
+
22
+ [Compare v1.3.0...v1.4.0](https://github.com/dry-rb/dry-struct/compare/v1.3.0...v1.4.0)
23
+
24
+ ## 1.3.0 2020-02-10
25
+
26
+
27
+ ### Added
28
+
29
+ - Nested structures will reuse type and key transformations from the enclosing struct (@flash-gordon)
30
+
31
+ ```ruby
32
+ class User < Dry::Struct
33
+ transform_keys(&:to_sym)
34
+
35
+ attribute :name, Types::String
36
+ attribute :address do
37
+ # this struct will inherit transform_keys(&:to_sym)
38
+ attribute :city, Types::String
39
+ end
40
+
41
+ # nested struct will _not_ transform keys because a parent
42
+ # struct is given
43
+ attribute :contacts, Dry::Struct do
44
+ attribute :email, Types::String
45
+ end
46
+ end
47
+ ```
48
+ - `Dry::Struct::Constructor` finally acts like a fully-featured type (@flash-gordon)
49
+ - `Dry::Struct.abstract` declares a struct class as abstract. An abstract class is used as a default superclass for nested structs (@flash-gordon)
50
+ - `Dry::Struct.to_ast` and struct compiler (@flash-gordon)
51
+ - Struct composition with `Dry::Struct.attributes_from`. It's more flexible than inheritance (@waiting-for-dev + @flash-gordon)
52
+
53
+ ```ruby
54
+ class Address < Dry::Struct
55
+ attribute :city, Types::String
56
+ attribute :zipcode, Types::String
57
+ end
58
+
59
+ class Buyer < Dry::Struct
60
+ attribute :name, Types::String
61
+ attributes_from Address
62
+ end
63
+
64
+ class Seller < Dry::Struct
65
+ attribute :name, Types::String
66
+ attribute :email, Types::String
67
+ attributes_from Address
68
+ end
69
+ ```
70
+
71
+ ### Changed
72
+
73
+ - [internal] metadata is now stored inside schema (@flash-gordon)
74
+
75
+ [Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-struct/compare/v1.2.0...v1.3.0)
76
+
77
+ ## 1.2.0 2019-12-20
78
+
79
+
80
+ ### Changed
81
+
82
+ - `Dry::Struct::Value` is deprecated. `Dry::Struct` instances were never meant to be mutable, we have no support for this. The only difference between `Dry::Struct` and `Dry::Struct::Value` is that the latter is deeply frozen. Freezing objects slows the code down and gives you very little benefit in return. If you have a use case for `Value`, it won't be hard to roll your own solution using [ice_nine](https://github.com/dkubb/ice_nine) (flash-gordon)
83
+ - In the thread of the previous change, structs now use immutable equalizer. This means `Struct#hash` memoizes its value after the first invocation. Depending on the case, this may speed up your code significantly (flash-gordon)
84
+
85
+ [Compare v1.1.1...v1.2.0](https://github.com/dry-rb/dry-struct/compare/v1.1.1...v1.2.0)
86
+
87
+ ## 1.1.1 2019-10-13
88
+
89
+
90
+ ### Changed
91
+
92
+ - Pattern matching syntax is simplified with `deconstruct_keys` (k-tsj)
93
+
94
+ ```ruby
95
+ User = Dry.Struct(name: 'string', email: 'string')
96
+
97
+ user = User.new(name: 'John Doe', email: 'john@acme.org')
98
+
99
+ case user
100
+ in User(name: 'John Doe', email:)
101
+ puts email
102
+ else
103
+ puts 'Not John'
104
+ end
105
+ ```
106
+
107
+ See more examples in the [specs](https://github.com/dry-rb/dry-struct/blob/8112772eb08d22ff2cd3e6997514d79a9b124968/spec/dry/struct/pattern_matching_spec.rb).
108
+
109
+ [Compare v1.1.0...v1.1.1](https://github.com/dry-rb/dry-struct/compare/v1.1.0...v1.1.1)
110
+
111
+ ## 1.1.0 2019-10-07
112
+
113
+
114
+ ### Added
115
+
116
+ - Experimental support for pattern matching :tada: (flash-gordon)
117
+
118
+
119
+ [Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-struct/compare/v1.0.0...v1.1.0)
120
+
121
+ ## 1.0.0 2019-04-23
122
+
123
+
124
+ ### Added
125
+
126
+ - `Struct.call` now accepts an optional block that will be called on failed coercion. This behavior is consistent with dry-types 1.0. Note that `.new` doesn't take a block (flash-gordon)
127
+ ```ruby
128
+ User = Dry::Struct(name: 'string')
129
+ User.(1) { :oh_no }
130
+ # => :oh_no
131
+ ```
132
+
133
+ ### Changed
134
+
135
+ - `valid?` and `===` behave differently, `===` works the same way `Class#===` does and `valid?` checks if the value _can be_ coerced to the struct (flash-gordon)
136
+
137
+ [Compare v0.7.0...v1.0.0](https://github.com/dry-rb/dry-struct/compare/v0.7.0...v1.0.0)
138
+
139
+ ## 0.7.0 2019-03-22
140
+
141
+
142
+ ### Changed
143
+
144
+ - [BREAKING] `Struct.input` was renamed `Struct.schema`, hence `Struct.schema` returns an instance of `Dry::Types::Hash::Schema` rather than a `Hash`. Schemas are also implementing `Enumerable` but they iterate over key types.
145
+ New API:
146
+ ```ruby
147
+ User.schema.each do |key|
148
+ puts "Key name: #{ key.name }"
149
+ puts "Key type: #{ key.type }"
150
+ end
151
+ ```
152
+ To get a type by its name use `.key`:
153
+ ```ruby
154
+ User.schema.key(:id) # => #<Dry::Types::Hash::Key ...>
155
+ ```
156
+ - [BREAKING] `transform_types` now passes one argument to the block, an instance of the `Key` type. Combined with the new API from dry-types it simplifies declaring omittable keys:
157
+ ```ruby
158
+ class StructWithOptionalKeys < Dry::Struct
159
+ transform_types { |key| key.required(false) }
160
+ # or simply
161
+ transform_types(&:omittable)
162
+ end
163
+ ```
164
+ - `Dry::Stuct#new` is now more efficient for partial updates (flash-gordon)
165
+ - Ruby 2.3 is EOL and not officially supported. It may work but we don't test it.
166
+
167
+ [Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-struct/compare/v0.6.0...v0.7.0)
168
+
169
+ ## 0.6.0 2018-10-24
170
+
171
+
172
+ ### Added
173
+
174
+ - `Struct.attribute?` is an easy way to define omittable attributes (flash-gordon):
10
175
 
11
176
  ```ruby
12
177
  class User < Dry::Struct
@@ -16,21 +181,22 @@
16
181
  # User.new(name: 'John') # => #<User name="John">
17
182
  ```
18
183
 
19
- ## Fixed
184
+ ### Fixed
20
185
 
21
- * `Struct#to_h` recursively converts hash values to hashes, this was done to be consistent with current behavior for arrays (oeoeaio + ZimbiX)
186
+ - `Struct#to_h` recursively converts hash values to hashes, this was done to be consistent with current behavior for arrays (oeoeaio + ZimbiX)
22
187
 
23
- [Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-struct/compare/v0.5.1...v0.6.0)
188
+ ### Changed
24
189
 
25
- # v0.5.1 2018-08-11
190
+ - [BREAKING] `Struct.attribute?` in the old sense is deprecated, use `has_attribute?` as a replacement
26
191
 
27
- ## Fixed
192
+ [Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-struct/compare/v0.5.1...v0.6.0)
193
+
194
+ ## 0.5.1 2018-08-11
28
195
 
29
- * Constant resolution is now restricted to the current module when structs are automatically defined using the block syntax. This shouldn't break any existing code (piktur)
30
196
 
31
- ## Added
197
+ ### Added
32
198
 
33
- * Pretty print extension (ojab)
199
+ - Pretty print extension (ojab)
34
200
  ```ruby
35
201
  Dry::Struct.load_extensions(:pretty_print)
36
202
  PP.pp(user)
@@ -40,20 +206,19 @@
40
206
  address=#<Test::Address city="NYC", zipcode="123">>
41
207
  ```
42
208
 
43
- [Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-struct/compare/v0.5.0...v0.5.1)
209
+ ### Fixed
44
210
 
45
- # v0.5.0 2018-05-03
211
+ - Constant resolution is now restricted to the current module when structs are automatically defined using the block syntax. This shouldn't break any existing code (piktur)
46
212
 
47
- ## BREAKING CHANGES
48
213
 
49
- * `constructor_type` was removed, use `transform_types` and `transform_keys` as a replacement (see below)
50
- * Default types are evaluated _only_ on missing values. Again, use `tranform_types` as a work around for `nil`s
51
- * Values are now stored within a single instance variable names `@attributes`, this sped up struct creation and improved support for reserved attribute names such as `hash`, they don't get a getter but still can be read via `#[]`
52
- * Ruby 2.3 is a minimal supported version
214
+ [Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-struct/compare/v0.5.0...v0.5.1)
215
+
216
+ ## 0.5.0 2018-05-03
217
+
53
218
 
54
- ## Added
219
+ ### Added
55
220
 
56
- * `Dry::Struct.transform_types` accepts a block which is yielded on every type to add. Since types are `dry-types`' objects that come with a robust DSL it's rather simple to restore the behavior of `constructor_type`. See https://github.com/dry-rb/dry-struct/pull/64 for details (flash-gordon)
221
+ - `Dry::Struct.transform_types` accepts a block which is yielded on every type to add. Since types are `dry-types`' objects that come with a robust DSL it's rather simple to restore the behavior of `constructor_type`. See https://github.com/dry-rb/dry-struct/pull/64 for details (flash-gordon)
57
222
 
58
223
  Example: evaluate defaults on `nil` values
59
224
 
@@ -64,18 +229,15 @@
64
229
  end
65
230
  end
66
231
  ```
67
-
68
- * `Data::Struct.transform_keys` accepts a block/proc that transforms keys of input hashes. The most obvious usage is simbolization but arbitrary transformations are allowed (flash-gordon)
69
-
70
- * `Dry.Struct` builds a struct by a hash of attribute names and types (citizen428)
232
+ - `Data::Struct.transform_keys` accepts a block/proc that transforms keys of input hashes. The most obvious usage is simbolization but arbitrary transformations are allowed (flash-gordon)
233
+ - `Dry.Struct` builds a struct by a hash of attribute names and types (citizen428)
71
234
 
72
235
  ```ruby
73
236
  User = Dry::Struct(name: 'strict.string') do
74
237
  attribute :email, 'strict.string'
75
238
  end
76
239
  ```
77
-
78
- * Support for `Struct.meta`, note that `.meta` returns a _new class_ (flash-gordon)
240
+ - Support for `Struct.meta`, note that `.meta` returns a _new class_ (flash-gordon)
79
241
 
80
242
  ```ruby
81
243
  class User < Dry::Struct
@@ -86,8 +248,7 @@
86
248
 
87
249
  User.new(name: 'Jade').class == UserWithMeta.new(name: 'Jade').class # => false
88
250
  ```
89
-
90
- * `Struct.attribute` yields a block with definition for nested structs. It defines a nested constant for the new struct and supports arrays (AMHOL + flash-gordon)
251
+ - `Struct.attribute` yields a block with definition for nested structs. It defines a nested constant for the new struct and supports arrays (AMHOL + flash-gordon)
91
252
 
92
253
  ```ruby
93
254
  class User < Dry::Struct
@@ -105,92 +266,103 @@
105
266
  # ^This automatically defines User::Address and User::Account
106
267
  ```
107
268
 
108
- ## Fixed
269
+ ### Fixed
270
+
271
+ - Adding a new attribute invalidates `attribute_names` (flash-gordon)
272
+ - Struct classes track subclasses and define attributes in them, now it doesn't matter whether you define attributes first and _then_ subclass or vice versa. Note this can lead to memory leaks in Rails environment when struct classes are reloaded (flash-gordon)
109
273
 
110
- * Adding a new attribute invalidates `attribute_names` (flash-gordon)
111
- * Struct classes track subclasses and define attributes in them, now it doesn't matter whether you define attributes first and _then_ subclass or vice versa. Note this can lead to memory leaks in Rails environment when struct classes are reloaded (flash-gordon)
112
274
 
113
275
  [Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-struct/compare/v0.4.0...v0.5.0)
114
276
 
115
- # v0.4.0 2017-11-04
277
+ ## 0.4.0 2017-11-04
278
+
116
279
 
117
- ## Changed
280
+ ### Fixed
118
281
 
119
- * Attribute readers don't override existing instance methods (solnic)
120
- * `Struct#new` uses raw attributes instead of method calls, this makes the behavior consistent with the change above (flash-gordon)
121
- * `constructor_type` now actively rejects `:weak` and `:symbolized` values (GustavoCaso)
282
+ - `Struct#new` doesn't call `.to_hash` recursively (flash-gordon)
122
283
 
123
- ## Fixed
284
+ ### Changed
124
285
 
125
- * `Struct#new` doesn't call `.to_hash` recursively (flash-gordon)
286
+ - Attribute readers don't override existing instance methods (solnic)
287
+ - `Struct#new` uses raw attributes instead of method calls, this makes the behavior consistent with the change above (flash-gordon)
288
+ - `constructor_type` now actively rejects `:weak` and `:symbolized` values (GustavoCaso)
126
289
 
127
290
  [Compare v0.3.1...v0.4.0](https://github.com/dry-rb/dry-struct/compare/v0.3.1...v0.4.0)
128
291
 
129
- # v0.3.1 2017-06-30
292
+ ## 0.3.1 2017-06-30
130
293
 
131
- ## Added
132
294
 
133
- * `Struct.constructor` that makes dry-struct more aligned with dry-types; now you can have a struct with a custom constructor that will be called _before_ calling the `new` method (v-kolesnikov)
134
- * `Struct.attribute?` and `Struct.attribute_names` for introspecting struct attributes (flash-gordon)
135
- * `Struct#__new__` is a safe-to-use-in-gems alias for `Struct#new` (flash-gordon)
295
+ ### Added
296
+
297
+ - `Struct.constructor` that makes dry-struct more aligned with dry-types; now you can have a struct with a custom constructor that will be called _before_ calling the `new` method (v-kolesnikov)
298
+ - `Struct.attribute?` and `Struct.attribute_names` for introspecting struct attributes (flash-gordon)
299
+ - `Struct#__new__` is a safe-to-use-in-gems alias for `Struct#new` (flash-gordon)
300
+
136
301
 
137
302
  [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-struct/compare/v0.3.0...v0.3.1)
138
303
 
139
- # v0.3.0 2017-05-05
304
+ ## 0.3.0 2017-05-05
305
+
140
306
 
141
- ## Added
307
+ ### Added
142
308
 
143
- * `Dry::Struct#new` method to return new instance with applied changeset (Kukunin)
309
+ - `Dry::Struct#new` method to return new instance with applied changeset (Kukunin)
144
310
 
145
- ## Fixed
311
+ ### Fixed
146
312
 
147
- * `.[]` and `.call` does not coerce subclass to superclass anymore (Kukunin)
148
- * Raise ArgumentError when attribute type is a string and no value provided is for `new` (GustavoCaso)
313
+ - `.[]` and `.call` does not coerce subclass to superclass anymore (Kukunin)
314
+ - Raise ArgumentError when attribute type is a string and no value provided is for `new` (GustavoCaso)
149
315
 
150
- ## Changed
316
+ ### Changed
151
317
 
152
- * `.new` without arguments doesn't use nil as an input for non-default types anymore (flash-gordon)
318
+ - `.new` without arguments doesn't use nil as an input for non-default types anymore (flash-gordon)
153
319
 
154
320
  [Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-struct/compare/v0.2.1...v0.3.0)
155
321
 
156
- # v0.2.1 2017-02-27
322
+ ## 0.2.1 2017-02-27
157
323
 
158
- ## Fixed
159
324
 
160
- * Fixed `Dry::Struct::Value` which appeared to be broken in the last release (flash-gordon)
325
+ ### Fixed
326
+
327
+ - Fixed `Dry::Struct::Value` which appeared to be broken in the last release (flash-gordon)
328
+
161
329
 
162
330
  [Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-struct/compare/v0.2.0...v0.2.1)
163
331
 
164
- # v0.2.0 2016-02-26
332
+ ## 0.2.0 2016-02-26
333
+
165
334
 
166
- ## Changed
335
+ ### Changed
167
336
 
168
- * Struct attributes can be overridden in a subclass (flash-gordon)
337
+ - Struct attributes can be overridden in a subclass (flash-gordon)
169
338
 
170
339
  [Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-struct/compare/v0.1.1...v0.2.0)
171
340
 
172
- # v0.1.1 2016-11-13
341
+ ## 0.1.1 2016-11-13
173
342
 
174
- ## Fixed
175
343
 
176
- * Make `Dry::Struct` act as a constrained type. This fixes the behavior of sum types containing structs (flash-gordon)
344
+ ### Fixed
345
+
346
+ - Make `Dry::Struct` act as a constrained type. This fixes the behavior of sum types containing structs (flash-gordon)
347
+
177
348
 
178
349
  [Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-struct/compare/v0.1.0...v0.1.1)
179
350
 
180
- # v0.1.0 2016-09-21
351
+ ## 0.1.0 2016-09-21
352
+
181
353
 
182
- ## Added
354
+ ### Added
183
355
 
184
- * `:strict_with_defaults` constructor type (backus)
356
+ - `:strict_with_defaults` constructor type (backus)
185
357
 
186
- ## Changed
358
+ ### Changed
187
359
 
188
- * [BREAKING] `:strict` was renamed to `:permissive` as it ignores missing keys (backus)
189
- * [BREAKING] `:strict` now raises on unexpected keys (backus)
190
- * Structs no longer auto-register themselves in the types container as they implement `Type` interface and we don't have to wrap them in `Type::Definition` (flash-gordon)
360
+ - [BREAKING] `:strict` was renamed to `:permissive` as it ignores missing keys (backus)
361
+ - [BREAKING] `:strict` now raises on unexpected keys (backus)
362
+ - Structs no longer auto-register themselves in the types container as they implement `Type` interface and we don't have to wrap them in `Type::Definition` (flash-gordon)
191
363
 
192
364
  [Compare v0.0.1...v0.1.0](https://github.com/dry-rb/dry-struct/compare/v0.0.1...v0.1.0)
193
365
 
194
- # v0.0.1 2016-07-17
366
+ ## 0.0.1 2016-07-17
195
367
 
196
368
  Initial release of code imported from dry-types
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2013-2016 Piotr Solnica
1
+ The MIT License (MIT)
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2015-2021 dry-rb team
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,25 +1,29 @@
1
1
  [gem]: https://rubygems.org/gems/dry-struct
2
- [travis]: https://travis-ci.org/dry-rb/dry-struct
3
- [codeclimate]: https://codeclimate.com/github/dry-rb/dry-struct
4
- [coveralls]: https://coveralls.io/r/dry-rb/dry-struct
2
+ [actions]: https://github.com/dry-rb/dry-struct/actions
3
+ [codacy]: https://www.codacy.com/gh/dry-rb/dry-struct
4
+ [chat]: https://dry-rb.zulipchat.com
5
5
  [inchpages]: http://inch-ci.org/github/dry-rb/dry-struct
6
6
 
7
- # dry-struct [![Join the chat at https://gitter.im/dry-rb/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dry-rb/chat)
7
+ # dry-struct [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
8
8
 
9
9
  [![Gem Version](https://badge.fury.io/rb/dry-struct.svg)][gem]
10
- [![Build Status](https://travis-ci.org/dry-rb/dry-struct.svg?branch=master)][travis]
11
- [![Code Climate](https://codeclimate.com/github/dry-rb/dry-struct/badges/gpa.svg)][codeclimate]
12
- [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-struct/badges/coverage.svg)][codeclimate]
10
+ [![CI Status](https://github.com/dry-rb/dry-struct/workflows/ci/badge.svg)][actions]
11
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/961f5c776f1d49218b2cede3745e059c)][codacy]
12
+ [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/961f5c776f1d49218b2cede3745e059c)][codacy]
13
13
  [![Inline docs](http://inch-ci.org/github/dry-rb/dry-struct.svg?branch=master)][inchpages]
14
14
 
15
- Typed structs and value objects
15
+ ## Links
16
16
 
17
- ## Development
17
+ * [User documentation](http://dry-rb.org/gems/dry-struct)
18
+ * [API documentation](http://rubydoc.info/gems/dry-struct)
18
19
 
19
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
20
+ ## Supported Ruby versions
20
21
 
21
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
22
+ This library officially supports the following Ruby versions:
22
23
 
23
- ## Contributing
24
+ * MRI >= `2.5`
25
+ * jruby >= `9.2`
24
26
 
25
- Bug reports and pull requests are welcome on GitHub at https://github.com/dry-rb/dry-struct.
27
+ ## License
28
+
29
+ See `LICENSE` file.
data/dry-struct.gemspec CHANGED
@@ -1,40 +1,39 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+ # this file is managed by dry-rb/devtools project
3
+
4
+ lib = File.expand_path('lib', __dir__)
2
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
6
  require 'dry/struct/version'
4
7
 
5
8
  Gem::Specification.new do |spec|
6
9
  spec.name = 'dry-struct'
7
- spec.version = Dry::Struct::VERSION
8
- spec.authors = ['Piotr Solnica']
9
- spec.email = ['piotr.solnica@gmail.com']
10
+ spec.authors = ["Piotr Solnica"]
11
+ spec.email = ["piotr.solnica@gmail.com"]
10
12
  spec.license = 'MIT'
13
+ spec.version = Dry::Struct::VERSION.dup
11
14
 
12
- spec.summary = 'Typed structs and value objects.'
15
+ spec.summary = "Typed structs and value objects"
13
16
  spec.description = spec.summary
14
- spec.homepage = 'https://github.com/dry-rb/dry-struct'
17
+ spec.homepage = 'https://dry-rb.org/gems/dry-struct'
18
+ spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-struct.gemspec", "lib/**/*"]
19
+ spec.bindir = 'bin'
20
+ spec.executables = []
21
+ spec.require_paths = ['lib']
15
22
 
16
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
- # delete this section to allow pushing this gem to any host.
18
- if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
- spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-struct/blob/master/CHANGELOG.md'
21
- spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-struct'
22
- else
23
- raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
24
- end
23
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
+ spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-struct/blob/master/CHANGELOG.md'
25
+ spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-struct'
26
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-struct/issues'
25
27
 
26
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ['lib']
28
+ spec.required_ruby_version = ">= 2.5.0"
30
29
 
31
- spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
32
- spec.add_runtime_dependency 'dry-types', '~> 0.13'
33
- spec.add_runtime_dependency 'dry-core', '~> 0.4', '>= 0.4.3'
34
- spec.add_runtime_dependency 'ice_nine', '~> 0.11'
30
+ # to update dependencies edit project.yml
31
+ spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
32
+ spec.add_runtime_dependency "dry-types", "~> 1.5"
33
+ spec.add_runtime_dependency "ice_nine", "~> 0.11"
35
34
 
36
- spec.add_development_dependency 'bundler', '~> 1.6'
37
- spec.add_development_dependency 'rake', '~> 11.0'
38
- spec.add_development_dependency 'rspec', '~> 3.3'
39
- spec.add_development_dependency 'yard', '~> 0.9.5'
35
+ spec.add_development_dependency "bundler"
36
+ spec.add_development_dependency "rake"
37
+ spec.add_development_dependency "rspec"
38
+ spec.add_development_dependency "yard"
40
39
  end