-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Fix block being passed to __dry_initializer_initialize__ #109
Comments
Thanks for reporting, I saw it too and I'll take a closer look today. It's either justified or not. In the later case we'll have to silence this warning with a monkey patch I'm afraid. The problem is there's no way know if a method yields a block or not if doesn't appear in the parameters. And even if it does appear it would be more costly than just ignoring the warning. |
Hmm, |
It will make ruby point to the correct source of the warning. ref #109
Thanks! Yeah, only forwarding positional and keyword parameters resolves this issue nicely. I also applied this patch locally and ran it across multiple projects and don't see any issues. My console is clean now. Would be nice to release a patch next if you don't see any further complications. |
@bkuhlmann I pushed 3.2.0, please check it out |
Thanks, yep, looks good. 🙇 I'll close this issue. |
Describe the bug
Hello. 👋 I'm getting multiple warnings in my console when using Dry Initializer due to a block being passed to
__dry_initializer_initialize__
when it shouldn't.This is showing up because Ruby 2.4.1 issues warnings when you pass a block that isn't used. See Feature #15554.
To Reproduce
I don't have a great way, at the moment, to reproduce this since the warning seems to be indirectly triggered via Dry Schema because I'm not requiring Dry Initializer directly. Regardless, you'll want to ensure the following is enabled for your environment:
I would expect the Dry Initializer test suite to be issuing these warnings too if warnings are enabled?
Expected behavior
I'd expect to not see this warning show up:
My environment
The text was updated successfully, but these errors were encountered: