Better: Add ruby 3.1 compatibility.
In https://github.com/ylecuyer/puma-status I had a red build because timecop isn't yet compatible with ruby 3.1
Run bundle exec rspec
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:29: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:35: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:35: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:44: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
TypeError: no implicit conversion of Hash into Integer
bundler: failed to load command: rspec (/home/runner/.rubies/ruby-head/bin/rspec)
<internal:timev>:123:in `initialize'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/timecop-0.9.1/lib/timecop/time_extensions.rb:22:in `new'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/timecop-0.9.1/lib/timecop/time_extensions.rb:22:in `new_with_mock_time'
<internal:timev>:10:in `now'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:89:in `start'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:72:in `report'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:115:in `run_specs'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:89:in `run'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:71:in `run'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:45:in `invoke'
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/rspec-core-3.9.1/exe/rspec:4:in `<top (required)>'
/home/runner/.rubies/ruby-head/bin/rspec:23:in `load'
/home/runner/.rubies/ruby-head/bin/rspec:23:in `<top (required)>'
Error: Process completed with exit code 1.
This is because of this new change in ruby 3.1: https://bugs.ruby-lang.org/issues/17485
This PR adds the support for it
#276 also has a fix for ruby 3.1
#276 also has a fix for ruby 3.1
Indeed, however ruby2_keyword is a temporary method devs can use until they get the code compatible and I read it will be deprecated and removed in future ruby version https://github.com/ruby/ruby/blob/master/vm_method.c#L2145
pvoutput uses this gem, also has this ruby 3.1 problem, see https://github.com/johnf/pvoutput/pull/22
@ylecuyer I like having a fix that we won't have to worry about down the road, but I think this change has an infinite loop on ruby-head.
Looks like the build is failing for 1.9.3
I merged another PR for ruby 3.1 support that is going into our 0.9.4 release. I still like the idea of this one since it doesn't use a method that will be removed in ruby 3.2 (maybe), but wanted to get things working for people. Feel free to get this approach working. We can revisit it.
While this was workaround in #288, I think this is superior fix.
I tried merging this but the build fails for ruby 3.1 I have reverted it.