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 +4 -4
- data/CHANGELOG.md +242 -70
- data/LICENSE +17 -17
- data/README.md +17 -13
- data/dry-struct.gemspec +26 -27
- data/lib/dry/struct/class_interface.rb +195 -111
- data/lib/dry/struct/compiler.rb +22 -0
- data/lib/dry/struct/constructor.rb +4 -24
- data/lib/dry/struct/errors.rb +13 -3
- data/lib/dry/struct/extensions/pretty_print.rb +7 -5
- data/lib/dry/struct/extensions.rb +3 -1
- data/lib/dry/struct/hashify.rb +6 -6
- data/lib/dry/struct/printer.rb +23 -0
- data/lib/dry/struct/struct_builder.rb +48 -25
- data/lib/dry/struct/sum.rb +16 -2
- data/lib/dry/struct/value.rb +13 -4
- data/lib/dry/struct/version.rb +3 -1
- data/lib/dry/struct.rb +62 -37
- data/lib/dry-struct.rb +3 -1
- metadata +38 -62
- data/.gitignore +0 -12
- data/.rspec +0 -2
- data/.travis.yml +0 -28
- data/.yardopts +0 -4
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -28
- data/Rakefile +0 -10
- data/benchmarks/basic.rb +0 -57
- data/benchmarks/constrained.rb +0 -37
- data/bin/console +0 -12
- data/bin/setup +0 -7
- data/log/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf0892469a434b85578e7350f52039b85203dbd251ca5c4bd6b038373edc703e
|
4
|
+
data.tar.gz: 263e3d2d4ce824be64210a27d074fb42126dde12d94e56290307d9ff08c0efad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08ea5f7780bac10495f93a5043c5e100fc9386688920e4e7fd1b2304ceaeb8f37853f6ed70f5d5a69b1d7a30c0340450f8ce41fba91e812e00cf6a008f9c2de0'
|
7
|
+
data.tar.gz: da176db2c5d8127ea7ef6a088edf7f8f4d18c74e65d96e7f6a80dd9822c0baefdfa1dd7eb6d607ac077c033d64dcddb0ca6c1498eb411c4cd94ea96e23c701b4
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,177 @@
|
|
1
|
-
|
1
|
+
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
-
##
|
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
|
-
|
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
|
-
|
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
|
-
|
184
|
+
### Fixed
|
20
185
|
|
21
|
-
|
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
|
-
|
188
|
+
### Changed
|
24
189
|
|
25
|
-
|
190
|
+
- [BREAKING] `Struct.attribute?` in the old sense is deprecated, use `has_attribute?` as a replacement
|
26
191
|
|
27
|
-
|
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
|
-
|
197
|
+
### Added
|
32
198
|
|
33
|
-
|
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
|
-
|
209
|
+
### Fixed
|
44
210
|
|
45
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
219
|
+
### Added
|
55
220
|
|
56
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
277
|
+
## 0.4.0 2017-11-04
|
278
|
+
|
116
279
|
|
117
|
-
|
280
|
+
### Fixed
|
118
281
|
|
119
|
-
|
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
|
-
|
284
|
+
### Changed
|
124
285
|
|
125
|
-
|
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
|
-
|
292
|
+
## 0.3.1 2017-06-30
|
130
293
|
|
131
|
-
## Added
|
132
294
|
|
133
|
-
|
134
|
-
|
135
|
-
|
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
|
-
|
304
|
+
## 0.3.0 2017-05-05
|
305
|
+
|
140
306
|
|
141
|
-
|
307
|
+
### Added
|
142
308
|
|
143
|
-
|
309
|
+
- `Dry::Struct#new` method to return new instance with applied changeset (Kukunin)
|
144
310
|
|
145
|
-
|
311
|
+
### Fixed
|
146
312
|
|
147
|
-
|
148
|
-
|
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
|
-
|
316
|
+
### Changed
|
151
317
|
|
152
|
-
|
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
|
-
|
322
|
+
## 0.2.1 2017-02-27
|
157
323
|
|
158
|
-
## Fixed
|
159
324
|
|
160
|
-
|
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
|
-
|
332
|
+
## 0.2.0 2016-02-26
|
333
|
+
|
165
334
|
|
166
|
-
|
335
|
+
### Changed
|
167
336
|
|
168
|
-
|
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
|
-
|
341
|
+
## 0.1.1 2016-11-13
|
173
342
|
|
174
|
-
## Fixed
|
175
343
|
|
176
|
-
|
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
|
-
|
351
|
+
## 0.1.0 2016-09-21
|
352
|
+
|
181
353
|
|
182
|
-
|
354
|
+
### Added
|
183
355
|
|
184
|
-
|
356
|
+
- `:strict_with_defaults` constructor type (backus)
|
185
357
|
|
186
|
-
|
358
|
+
### Changed
|
187
359
|
|
188
|
-
|
189
|
-
|
190
|
-
|
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
|
-
|
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
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
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
|
-
|
12
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
[
|
3
|
-
[
|
4
|
-
[
|
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 [][chat]
|
8
8
|
|
9
9
|
[][gem]
|
10
|
-
[][actions]
|
11
|
+
[][codacy]
|
12
|
+
[][codacy]
|
13
13
|
[][inchpages]
|
14
14
|
|
15
|
-
|
15
|
+
## Links
|
16
16
|
|
17
|
-
|
17
|
+
* [User documentation](http://dry-rb.org/gems/dry-struct)
|
18
|
+
* [API documentation](http://rubydoc.info/gems/dry-struct)
|
18
19
|
|
19
|
-
|
20
|
+
## Supported Ruby versions
|
20
21
|
|
21
|
-
|
22
|
+
This library officially supports the following Ruby versions:
|
22
23
|
|
23
|
-
|
24
|
+
* MRI >= `2.5`
|
25
|
+
* jruby >= `9.2`
|
24
26
|
|
25
|
-
|
27
|
+
## License
|
28
|
+
|
29
|
+
See `LICENSE` file.
|
data/dry-struct.gemspec
CHANGED
@@ -1,40 +1,39 @@
|
|
1
|
-
|
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.
|
8
|
-
spec.
|
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 =
|
15
|
+
spec.summary = "Typed structs and value objects"
|
13
16
|
spec.description = spec.summary
|
14
|
-
spec.homepage = 'https://
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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.
|
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
|
-
|
32
|
-
spec.add_runtime_dependency
|
33
|
-
spec.add_runtime_dependency
|
34
|
-
spec.add_runtime_dependency
|
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
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
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
|