-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support for newer rubies #63
base: master
Are you sure you want to change the base?
Conversation
This is mostly to do with the keyword arguments being more strict. Where we used to be able to just throw a hash to a method, we now need to explicitly tell ruby to treat the hash as keyword arguments. This fixes these calls. We have a couple of places in our used gems where this still pops up: /Users/pjaspers/development/blsq/orbf-rules_engine/vendor/ruby/2.7.0/gems/dentaku-3.3.4/lib/dentaku/exceptions.rb:95: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/pjaspers/development/blsq/orbf-rules_engine/vendor/ruby/2.7.0/gems/dentaku-3.3.4/lib/dentaku/exceptions.rb:78: warning: The called method `initialize' is defined here And /Users/pjaspers/development/blsq/orbf-rules_engine/vendor/ruby/2.7.0/gems/dhis2-2.3.8/lib/dhis2/collection_wrapper.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/pjaspers/development/blsq/orbf-rules_engine/vendor/ruby/2.7.0/gems/dhis2-2.3.8/lib/dhis2/api/analytic.rb:7: warning: The called method `list' is defined here
Explicitly install newer bundler (travis defaults to 1.x bundler), on ruby 2.7 this step isn't needed, but the other ones do need it. Since the bundler will be cached after the first install let's keep it like this.
a95cd0c
to
487063c
Compare
my timings
2.7.1 causing a lot of warnings :
did a bundle update and re-run on 2.7.1, most warnings disappeared That's still a lot slower for compared to 2.5. |
2.7.1 reverting https://github.com/BLSQ/orbf-rules_engine/pull/63/files#diff-2d8c0e5a8f1f0a37f717eae85275cba7R73 Finished in 7.23 seconds (files took 0.70755 seconds to load) |
pkill firefox |
OK, I'll look into the revert. See if I can avoid the |
now going to bed... but why don't you observe the same timings... |
I have a much slower computer :) But the results are kind of in line (and the double splat does make a big difference). My fix for the warning was actually not really the right solution to the problem. class Hi
def initialize(hash)
puts hash
end
def self.with(hash)
new(hash)
end
end
class HiAgain < Hi
def initialize(it: me)
# Because we're overriding the initialize with keywords
# ruby is throwing the warning
end
end
hi = Hi.with(a: "b", c: "d")
HiAgain.with(it: "me") # this will throw the waring Is my reduced case, where I can trigger the warning. |
This adds support for rubies greater than 2.5 (including the newish ruby 2.7)
In 2.6 they deprecated
BigDecimal.new
which was used byDentaku
so I had to upgrade, Dentaku as well, they added some functions we already added (but we don't seem to clash).The other big changes are ruby being more strict about calling functions with keyword arguments.
I've taken some timings along the way (by running the test suite three times):
Baseline (without) any changes: 10.66s
After bundle update: 10.85s
Dentaku update: 10.6s
Ruby 2.7.1: 10.86s
(these are chronologically, so the ruby 2.7.1 has all the other updates in it as well)
So I don't really see any big regressions, but the proof in the pudding will be to run the tests in
orbf2
with newer rubies. Based on this, we know that the engine will supports them.Travis will now run the test suite for all three ruby versions: 2.5, 2.6 and 2.7