-
Notifications
You must be signed in to change notification settings - Fork 413
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 for deprecation warnings in ruby 2.7.x #241
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #241 +/- ##
===========================================
- Coverage 100.00% 98.87% -1.13%
===========================================
Files 26 17 -9
Lines 530 354 -176
===========================================
- Hits 530 350 -180
- Misses 0 4 +4 Continue to review full report at Codecov.
|
Doesn't that fail with 1.9 syntax? |
Isn't the ruby 1.9 end of life? |
Regardless the end of life of 1.9, I wouldn't like to break systems that still use it, especially because pagy is backward compatible till 1.9 and I personally use it in legacy systems. Besides, I just noticed that your change does actually change the semantic of the method, and does not work as it is supposed to work. Indeed i18n tests fail with your change. |
And... I don't see any deprecation warning running the tests in 2.7.1 (https://travis-ci.org/github/ddnexus/pagy/jobs/678434972). Where is your warning coming from? |
|
Seems it comes from https://github.com/ruby-i18n/i18n/ I'm sorry. |
It actually looks like it may come from how pagy calls the |
It could be due to the i18n 1.8.2 version. Travis runs with 1.6.0. Please could you temporarily downgrade it to 1.6.0 and check if the warning is still there? |
The warning is not displayed with i18n 1.6.0. Check this out: https://github.com/ruby-i18n/i18n/blob/master/lib/i18n.rb#L188 |
Your link points to the 1.8.2 code. The 1.6.0 code defines the same arguments for the method I really don't get how it could not raise the same warning if you still run it on 2.7+. The only difference about the versions is a comment added to the method (see ruby-i18n/i18n#501), so how comes that the warning disappears? |
…ast argument as keyword parameters" deprecation warning (closes #241)
it breaks old rubies though :/ |
Maybe something like this can be used? if RUBY_VERSION >= "2.7"
def pagy_t_with_i18n(key, **opts) ::I18n.t(key, **opts) end
else
def pagy_t_with_i18n(*args) ::I18n.t(*args) end
end |
…ast argument as keyword parameters" deprecation warning (closes #241)
Thank you for the effort, but that would not avoid the syntax error for ruby <2.0. |
BTW, |
Thank you for the PR and your time. |
This pull request fixes the warnings for Ruby 2.7.x.