Released (as always) on 25 December, 2019, the latest major Ruby release is 2.7.0. I have installed it as my global Ruby (via rbenv), and then I started upgrading my various projects. Oops. It turns out a lot of Ruby Gems used by Rails and Middleman have some cleanup to do before they can make the transition to Ruby 2.7. Here’s what I have been seeing:

URI.escape

The docs say:

“use CGI.escape, URI.encode_www_form or URI.encode_www_form_component depending on your specific use case.”

Which means that each use of URI.escape needs to be evaluated in situ. Ugh. I know I’ve been guilty of tossing in URI.escape into my code “just to be safe”, so the code clean up on this one could be potentially expensive.

positional and keyword arguments

The Rails 5.2.2 server log throws this kind of thing:

.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-5.2.4.1/lib/action_dispatch/middleware/cookies.rb:647: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

and also:

.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-5.2.4.1/lib/action_controller/metal/request_forgery_protection.rb:307: warning: The called method `form_authenticity_token’ is defined here

Yes, you can suppress the warnings with an option flag, as described here, but I decided against that.

The good news: none of my apps break on Ruby 2.7, but they all throw the warning messages described above into the log files and STDOUT. Ugly.

Soooo – back to Ruby 2.6.5 for now, as noted in my GitHub commits. I’ll keep 2.7.0 as my global Ruby setting so I can continue to explore its new features.