Ruby 3.0 support added, 2.6 removed #22120
jrafanie
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
As of yesterday, we merged support for ruby 3.0 on ManageIQ and the various libraries, providers and engines that utilize ManageIQ. Along with adding ruby 3.0 support, we have dropped ruby 2.6 which had reached end of life with the ruby team back in March.
For more information on 3.0, please see the official release notes.
You can stop here if you're not a ruby and rails developer...
For developers, of highest importance for compatibility was the change that separated positional arguments from keyword arguments.
Basically, keyword arguments are no longer treated as a hash argument as the last argument passed to a method. Additionally, you cannot provide a
Hashwhen a method expects keyword arguments. The count of positional arguments or arity is now different as keyword arguments are treated completely differently. With this comes the great possibility ofArgumentErrorexceptions with ruby 2.x code that's run in ruby 3.0.Often times, this occurs when a
methodaccepts keyword arguments but is provided aHash, or conversely, if themethodaccepts a positional optionsHashbut are provided keyword arguments. In most situations, you can fix this by makingHasharguments explicit such as changing the method call fromfoo(:x => 1)tofoo({:x => 1})or vice versa. Additionally methods can leverage**kargsin method definitions to expand keyword arguments to aHash. Combined with*argsin the method definition, you can attempt to handle method calls written with ruby 2.x or 3.x in mind.Be careful though, as maintaining ruby 2.x and 3.x compatibility is not easy. For more information, I suggest looking at a blog post from a ruby committer Benoit Daloze because many of the different wrong ways to handle this are addressed.
Beta Was this translation helpful? Give feedback.
All reactions