Nikita Shilnikov

Results 182 comments of Nikita Shilnikov

By the way, not to discourage you but pls submit a question about adding new features on the forum first. It would be a shame if you spend a lot...

> So I just used this as a patch in my own project and I'm noticing that Strict::String.enum([:a, :b, :c])['a'] raises a constraint error. First off I'm not sure why...

In this case, the docs should be updated. Thanks for filing the issue

Can you point out where you found this class definition? ```ruby class User def initialize(name:) @name = name end end ```

> The docs don't have it there but based on the [example here](https://dry-rb.org/gems/dry-types/1.7/custom-types/#code-types-constructor-code), I think it is the User definition. This assumption is wrong, `Types.Constructor` expects sequential arguments. The correct...

> I did it as a temporary fix: I would suggest using a different name ```ruby module Types include Dry::Types(default: :strict) def self.KwConstructor(klass) # DryTypes Constructor doesn't support Ruby 3.1...

It's because dry-initializer uses keywords. Before 3.0 ruby was more permissive regarding passing hashes where keywords are expected. Once a clear separation was made in 3.0 it doesn't work magically...

It is intentional, it's also documented in the docs. I don't remember the details but I think it's related to using PM in the following scenario: ```ruby case Failure[:error, 'oops']...

IIRC the shorthand `Failure[error_code, message]` was added some time before PM was a thing in ruby. Then, in order to support it in PM, I had to add that hack....