-
Notifications
You must be signed in to change notification settings - Fork 17
def_*_delegator from v1.3.0 does not return name of delegator method in Ruby 2.6 and older #10
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
Comments
The return value of That being said, I am not opposed to putting out a 1.3.1 that restores the previous behavior and adds documentation and specs for it. I'll submit a pull request later today, and hopefully @hsbt can handle the release. In the future, please use a more accurate subject. 1.3.0 isn't broken, it works for almost all cases. That the undefined behavior in 1.3.0 differs from previous undefined behavior, and it caused a problem in a widely-used application is unfortunate, but no reason for hyperbole. |
@jeremyevans Thank you for responding. I was not aware that the usage I was familiar with is an undocumented behavior that shouldn't be considered as public API. Moving forward, what would be the best way to conform to this module's Public API yet maintain the downstream's current behavior? |
Make def_*_delegator return name of method defined (Fixes #10)
In v1.2.0,
def_delegator :@obj, :data, :fallback_data
would return:fallback_data
but v1.3.0 just returnsnil
The cause for this is the last expression
mod.send(:ruby2_keywords, ali) if RUBY_VERSION >= '2.7'
in the following definition:forwardable/lib/forwardable.rb
Lines 182 to 189 in e56f0f8
The last expression is evaluated only if
RUBY_VERSION >= '2.7'
.The preferred solution would be to stash the result of the previous expression and return that stashed value for Ruby 2.6 and older:
Based on the diff of #5, this issue would affect
:single_delegator
as well./cc @jeremyevans @hsbt Requesting a patch to be shipped at the earliest.
Thank you.
The text was updated successfully, but these errors were encountered: