-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conflict with active_support :try #78
Comments
The problem here is that ActiveSupport monkey patches
And therefore the method_missing is never hit. I'm not sure what dry-types should do in that cases where another thirdparty lib monkey patches basically everything. You mentioned it's working in other scenarios. Can you give 1 example where exactly so I can lookup the differences. I'm not sure how many methods |
I only tried it with some other types and there it worked. So something like.
Form my point of view this is caused by how the array type and enum works together. I just wasn't sure if a similar approach to the explicit usage/exploit of method_missing in enum is used somewhere else. |
For you're given example:
I get following behaviour:
The reason why this works is because in dry-types/lib/dry/types/constructor.rb Line 32 in 9d72307
So I see 2 possible solutions for now:
|
IMHO relying on I haven't dug into the code to deep but I've tried to have Would it be possible to completely remove the reliance on method_missing? Meaning not only for this special case but in general. |
It looks like you're heading in a good direction, @andreaseger. To me it seems like it's the
|
Let's just implement |
The internal use of the method
try
in combination with method_missing runs into an error as soon as active_support with it'stry
core_ext is required.I'm not sure the method_missing cascade is used similar in other scenarios.
Given how common active_support is even outside rails applications this seems like a issue that should be fixed. Without to much insight into the code renaming the try method to something unique or changing how the method_missing cascade is used here might be an option so solve this.
The text was updated successfully, but these errors were encountered: