dry-struct 1.0.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 +208 -82
- data/LICENSE +17 -17
- data/README.md +16 -12
- data/dry-struct.gemspec +26 -28
- data/lib/dry-struct.rb +3 -1
- data/lib/dry/struct.rb +55 -34
- data/lib/dry/struct/class_interface.rb +135 -72
- 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.rb +3 -1
- data/lib/dry/struct/extensions/pretty_print.rb +7 -5
- data/lib/dry/struct/hashify.rb +6 -6
- data/lib/dry/struct/printer.rb +6 -1
- data/lib/dry/struct/struct_builder.rb +47 -24
- data/lib/dry/struct/sum.rb +5 -2
- data/lib/dry/struct/value.rb +13 -4
- data/lib/dry/struct/version.rb +3 -1
- metadata +33 -59
- data/.gitignore +0 -12
- data/.rspec +0 -2
- data/.travis.yml +0 -29
- data/.yardopts +0 -4
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -26
- data/Rakefile +0 -10
- data/benchmarks/basic.rb +0 -57
- data/benchmarks/constrained.rb +0 -37
- data/benchmarks/profile_instantiation.rb +0 -19
- data/benchmarks/setup.rb +0 -11
- 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,25 +1,147 @@
|
|
|
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
|
-
* `valid?` and `===` behave differently, `===` works the same way `Class#===` does and `valid?` checks if the value _can be_ coerced to the struct (flash-gordon)
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
### Added
|
|
8
7
|
|
|
9
|
-
|
|
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
|
+
```
|
|
20
|
+
|
|
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)
|
|
10
127
|
```ruby
|
|
11
128
|
User = Dry::Struct(name: 'string')
|
|
12
129
|
User.(1) { :oh_no }
|
|
13
130
|
# => :oh_no
|
|
14
131
|
```
|
|
15
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
|
+
|
|
16
137
|
[Compare v0.7.0...v1.0.0](https://github.com/dry-rb/dry-struct/compare/v0.7.0...v1.0.0)
|
|
17
138
|
|
|
18
|
-
|
|
139
|
+
## 0.7.0 2019-03-22
|
|
140
|
+
|
|
19
141
|
|
|
20
|
-
|
|
142
|
+
### Changed
|
|
21
143
|
|
|
22
|
-
|
|
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.
|
|
23
145
|
New API:
|
|
24
146
|
```ruby
|
|
25
147
|
User.schema.each do |key|
|
|
@@ -31,7 +153,7 @@
|
|
|
31
153
|
```ruby
|
|
32
154
|
User.schema.key(:id) # => #<Dry::Types::Hash::Key ...>
|
|
33
155
|
```
|
|
34
|
-
|
|
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:
|
|
35
157
|
```ruby
|
|
36
158
|
class StructWithOptionalKeys < Dry::Struct
|
|
37
159
|
transform_types { |key| key.required(false) }
|
|
@@ -39,20 +161,17 @@
|
|
|
39
161
|
transform_types(&:omittable)
|
|
40
162
|
end
|
|
41
163
|
```
|
|
42
|
-
|
|
43
|
-
|
|
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.
|
|
44
166
|
|
|
45
167
|
[Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-struct/compare/v0.6.0...v0.7.0)
|
|
46
168
|
|
|
47
|
-
|
|
169
|
+
## 0.6.0 2018-10-24
|
|
48
170
|
|
|
49
|
-
## Changed
|
|
50
171
|
|
|
51
|
-
|
|
172
|
+
### Added
|
|
52
173
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* `Struct.attribute?` is an easy way to define omittable attributes (flash-gordon):
|
|
174
|
+
- `Struct.attribute?` is an easy way to define omittable attributes (flash-gordon):
|
|
56
175
|
|
|
57
176
|
```ruby
|
|
58
177
|
class User < Dry::Struct
|
|
@@ -62,21 +181,22 @@
|
|
|
62
181
|
# User.new(name: 'John') # => #<User name="John">
|
|
63
182
|
```
|
|
64
183
|
|
|
65
|
-
|
|
184
|
+
### Fixed
|
|
66
185
|
|
|
67
|
-
|
|
186
|
+
- `Struct#to_h` recursively converts hash values to hashes, this was done to be consistent with current behavior for arrays (oeoeaio + ZimbiX)
|
|
68
187
|
|
|
69
|
-
|
|
188
|
+
### Changed
|
|
70
189
|
|
|
71
|
-
|
|
190
|
+
- [BREAKING] `Struct.attribute?` in the old sense is deprecated, use `has_attribute?` as a replacement
|
|
72
191
|
|
|
73
|
-
|
|
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
|
|
74
195
|
|
|
75
|
-
* 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)
|
|
76
196
|
|
|
77
|
-
|
|
197
|
+
### Added
|
|
78
198
|
|
|
79
|
-
|
|
199
|
+
- Pretty print extension (ojab)
|
|
80
200
|
```ruby
|
|
81
201
|
Dry::Struct.load_extensions(:pretty_print)
|
|
82
202
|
PP.pp(user)
|
|
@@ -86,20 +206,19 @@
|
|
|
86
206
|
address=#<Test::Address city="NYC", zipcode="123">>
|
|
87
207
|
```
|
|
88
208
|
|
|
89
|
-
|
|
209
|
+
### Fixed
|
|
90
210
|
|
|
91
|
-
|
|
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)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
[Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-struct/compare/v0.5.0...v0.5.1)
|
|
92
215
|
|
|
93
|
-
##
|
|
216
|
+
## 0.5.0 2018-05-03
|
|
94
217
|
|
|
95
|
-
* `constructor_type` was removed, use `transform_types` and `transform_keys` as a replacement (see below)
|
|
96
|
-
* Default types are evaluated _only_ on missing values. Again, use `tranform_types` as a work around for `nil`s
|
|
97
|
-
* 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 `#[]`
|
|
98
|
-
* Ruby 2.3 is a minimal supported version
|
|
99
218
|
|
|
100
|
-
|
|
219
|
+
### Added
|
|
101
220
|
|
|
102
|
-
|
|
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)
|
|
103
222
|
|
|
104
223
|
Example: evaluate defaults on `nil` values
|
|
105
224
|
|
|
@@ -110,18 +229,15 @@
|
|
|
110
229
|
end
|
|
111
230
|
end
|
|
112
231
|
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
* `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)
|
|
117
234
|
|
|
118
235
|
```ruby
|
|
119
236
|
User = Dry::Struct(name: 'strict.string') do
|
|
120
237
|
attribute :email, 'strict.string'
|
|
121
238
|
end
|
|
122
239
|
```
|
|
123
|
-
|
|
124
|
-
* 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)
|
|
125
241
|
|
|
126
242
|
```ruby
|
|
127
243
|
class User < Dry::Struct
|
|
@@ -132,8 +248,7 @@
|
|
|
132
248
|
|
|
133
249
|
User.new(name: 'Jade').class == UserWithMeta.new(name: 'Jade').class # => false
|
|
134
250
|
```
|
|
135
|
-
|
|
136
|
-
* `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)
|
|
137
252
|
|
|
138
253
|
```ruby
|
|
139
254
|
class User < Dry::Struct
|
|
@@ -151,92 +266,103 @@
|
|
|
151
266
|
# ^This automatically defines User::Address and User::Account
|
|
152
267
|
```
|
|
153
268
|
|
|
154
|
-
|
|
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)
|
|
155
273
|
|
|
156
|
-
* Adding a new attribute invalidates `attribute_names` (flash-gordon)
|
|
157
|
-
* 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)
|
|
158
274
|
|
|
159
275
|
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-struct/compare/v0.4.0...v0.5.0)
|
|
160
276
|
|
|
161
|
-
|
|
277
|
+
## 0.4.0 2017-11-04
|
|
162
278
|
|
|
163
|
-
## Changed
|
|
164
279
|
|
|
165
|
-
|
|
166
|
-
* `Struct#new` uses raw attributes instead of method calls, this makes the behavior consistent with the change above (flash-gordon)
|
|
167
|
-
* `constructor_type` now actively rejects `:weak` and `:symbolized` values (GustavoCaso)
|
|
280
|
+
### Fixed
|
|
168
281
|
|
|
169
|
-
|
|
282
|
+
- `Struct#new` doesn't call `.to_hash` recursively (flash-gordon)
|
|
170
283
|
|
|
171
|
-
|
|
284
|
+
### Changed
|
|
285
|
+
|
|
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)
|
|
172
289
|
|
|
173
290
|
[Compare v0.3.1...v0.4.0](https://github.com/dry-rb/dry-struct/compare/v0.3.1...v0.4.0)
|
|
174
291
|
|
|
175
|
-
|
|
292
|
+
## 0.3.1 2017-06-30
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
### Added
|
|
176
296
|
|
|
177
|
-
|
|
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)
|
|
178
300
|
|
|
179
|
-
* `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)
|
|
180
|
-
* `Struct.attribute?` and `Struct.attribute_names` for introspecting struct attributes (flash-gordon)
|
|
181
|
-
* `Struct#__new__` is a safe-to-use-in-gems alias for `Struct#new` (flash-gordon)
|
|
182
301
|
|
|
183
302
|
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-struct/compare/v0.3.0...v0.3.1)
|
|
184
303
|
|
|
185
|
-
|
|
304
|
+
## 0.3.0 2017-05-05
|
|
186
305
|
|
|
187
|
-
## Added
|
|
188
306
|
|
|
189
|
-
|
|
307
|
+
### Added
|
|
190
308
|
|
|
191
|
-
|
|
309
|
+
- `Dry::Struct#new` method to return new instance with applied changeset (Kukunin)
|
|
192
310
|
|
|
193
|
-
|
|
194
|
-
* Raise ArgumentError when attribute type is a string and no value provided is for `new` (GustavoCaso)
|
|
311
|
+
### Fixed
|
|
195
312
|
|
|
196
|
-
|
|
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)
|
|
197
315
|
|
|
198
|
-
|
|
316
|
+
### Changed
|
|
317
|
+
|
|
318
|
+
- `.new` without arguments doesn't use nil as an input for non-default types anymore (flash-gordon)
|
|
199
319
|
|
|
200
320
|
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-struct/compare/v0.2.1...v0.3.0)
|
|
201
321
|
|
|
202
|
-
|
|
322
|
+
## 0.2.1 2017-02-27
|
|
323
|
+
|
|
203
324
|
|
|
204
|
-
|
|
325
|
+
### Fixed
|
|
326
|
+
|
|
327
|
+
- Fixed `Dry::Struct::Value` which appeared to be broken in the last release (flash-gordon)
|
|
205
328
|
|
|
206
|
-
* Fixed `Dry::Struct::Value` which appeared to be broken in the last release (flash-gordon)
|
|
207
329
|
|
|
208
330
|
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-struct/compare/v0.2.0...v0.2.1)
|
|
209
331
|
|
|
210
|
-
|
|
332
|
+
## 0.2.0 2016-02-26
|
|
333
|
+
|
|
211
334
|
|
|
212
|
-
|
|
335
|
+
### Changed
|
|
213
336
|
|
|
214
|
-
|
|
337
|
+
- Struct attributes can be overridden in a subclass (flash-gordon)
|
|
215
338
|
|
|
216
339
|
[Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-struct/compare/v0.1.1...v0.2.0)
|
|
217
340
|
|
|
218
|
-
|
|
341
|
+
## 0.1.1 2016-11-13
|
|
342
|
+
|
|
219
343
|
|
|
220
|
-
|
|
344
|
+
### Fixed
|
|
345
|
+
|
|
346
|
+
- Make `Dry::Struct` act as a constrained type. This fixes the behavior of sum types containing structs (flash-gordon)
|
|
221
347
|
|
|
222
|
-
* Make `Dry::Struct` act as a constrained type. This fixes the behavior of sum types containing structs (flash-gordon)
|
|
223
348
|
|
|
224
349
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-struct/compare/v0.1.0...v0.1.1)
|
|
225
350
|
|
|
226
|
-
|
|
351
|
+
## 0.1.0 2016-09-21
|
|
352
|
+
|
|
227
353
|
|
|
228
|
-
|
|
354
|
+
### Added
|
|
229
355
|
|
|
230
|
-
|
|
356
|
+
- `:strict_with_defaults` constructor type (backus)
|
|
231
357
|
|
|
232
|
-
|
|
358
|
+
### Changed
|
|
233
359
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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)
|
|
237
363
|
|
|
238
364
|
[Compare v0.0.1...v0.1.0](https://github.com/dry-rb/dry-struct/compare/v0.0.1...v0.1.0)
|
|
239
365
|
|
|
240
|
-
|
|
366
|
+
## 0.0.1 2016-07-17
|
|
241
367
|
|
|
242
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.
|