-
Notifications
You must be signed in to change notification settings - Fork 527
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: Don't delegate public methods overridden by a private in the decorator #849
fix: Don't delegate public methods overridden by a private in the decorator #849
Conversation
Public methods defined on the object was being delegated to the decorator even though it was overridden by a private method. Fix #771
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I left to nitpicky suggestions on style / formatting, but other than that, it's good to go. I wonder how breaking of a change this should be considered.
Co-Authored-By: brunohkbx <bruno.castro@codeminer42.com>
Co-Authored-By: brunohkbx <bruno.castro@codeminer42.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your contributions lately, they have been greatly appreciated!
@codebycliff I was thinking the same. Could it be a breaking change? 🤔 |
@brunohkbx I think that's definitely an option. I'm also considering just bumping the major version when I release this. It's been a while since a major version has been released, so I don't think it would be that big of a deal. |
drapergem#849 introduced a valid fix to prevent calling object's public method when a decorator overwrites it through a private one. There is one caveat, though. `private_methods` methods has `all` parameter set to `true` by default (https://ruby-doc.org/core-2.7.0/Object.html#method-i-private_methods)`. As a result all private methods are returned, instead of only the ones defined on the object. This commit fixes the above issue by setting the `all` parameter to `false`.
@brunohkbx & @codebycliff I need your attention #875. Thanks in advance 🙂 |
drapergem#849 introduced a valid fix to prevent calling object's public method when a decorator overwrites it through a private one. There is one caveat, though. `private_methods` methods has `all` parameter set to `true` by default (https://ruby-doc.org/core-2.7.0/Object.html#method-i-private_methods)`. As a result all private methods are returned, instead of only the ones defined on the object. This commit fixes the above issue by setting the `all` parameter to `false`.
#849 introduced a valid fix to prevent calling object's public method when a decorator overwrites it through a private one. There is one caveat, though. `private_methods` methods has `all` parameter set to `true` by default (https://ruby-doc.org/core-2.7.0/Object.html#method-i-private_methods)`. As a result all private methods are returned, instead of only the ones defined on the object. This commit fixes the above issue by setting the `all` parameter to `false`.
Public methods defined on the object was being delegated to the decorator even though it was overridden by a private method.
Testing
.location
from the decoratorReferences