You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fixed coercion errors for structs (issue #192 via #193) (@flash-gordon)
@@ -86,49 +82,42 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
86
82
-`Dry::Struct::Error` is now a subclass of `Dry::Types::CoercionError` (in #193) (@flash-gordon)
87
83
-`Dry::Struct#[]` now returns `nil` if an optional attribute is not set. This is consistent with calling accessor methods for optional attributes. (issue #171 via #194) (@ivleonov + @flash-gordon)
-`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)
209
195
- 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)
- Pattern matching syntax is simplified with `deconstruct_keys` (k-tsj)
@@ -232,21 +217,18 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
232
217
233
218
See more examples in the [specs](https://github.com/dry-rb/dry-struct/blob/8112772eb08d22ff2cd3e6997514d79a9b124968/spec/dry/struct/pattern_matching_spec.rb).
-`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)
@@ -260,11 +242,10 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
260
242
261
243
-`valid?` and `===` behave differently, `===` works the same way `Class#===` does and `valid?` checks if the value _can be_ coerced to the struct (flash-gordon)
-[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.
@@ -290,11 +271,10 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
290
271
-`Dry::Stuct#new` is now more efficient for partial updates (flash-gordon)
291
272
- Ruby 2.3 is EOL and not officially supported. It may work but we don't test it.
@@ -336,12 +315,10 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
336
315
337
316
- 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)
-`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)
@@ -397,12 +374,10 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
397
374
- Adding a new attribute invalidates `attribute_names` (flash-gordon)
398
375
- 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)
-`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)
424
398
-`Struct.attribute?` and `Struct.attribute_names` for introspecting struct attributes (flash-gordon)
425
399
-`Struct#__new__` is a safe-to-use-in-gems alias for `Struct#new` (flash-gordon)
-`:strict_with_defaults` constructor type (backus)
@@ -487,8 +453,10 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
487
453
-[BREAKING]`:strict` now raises on unexpected keys (backus)
488
454
- 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)
0 commit comments