Skip to content
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

Preserve Ruby 2.7 behavior for Ruby keyword args #11

Merged
merged 9 commits into from
Aug 15, 2023
Merged

Conversation

Jonic
Copy link

@Jonic Jonic commented Aug 15, 2023

Applies ruby2_keywords to the Command.call method, which preserves the Ruby 2.7 behavior for keyword args.

The result of these changes is that Rectify will continue to work with the existing behavior for keyword args once we've upgraded Panacea to Ruby 3. We've had to take this approach because fixing it would have also required us to upgrade Rectify to only work on Ruby >= 3.0. This is due to the fact that our particular use of kwargs in the Command pattern are considered a "corner case", preventing us from adopting the new behavior in our Ruby 2.7 code.

See: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/ - search this page for the string "If your code doesn’t have to run on Ruby 2.6 or older"

So what does all this mean?

In short, we don't have to worry about Rectify anymore. Once this has merged, we've released 0.14.0, and we've updated Panacea to use this new version, our existing use of Rectify Commands will continue to work even after we've upgraded the application to run on Ruby 3.0.

This allows us to almost forget about the old Rectify-powered commands, and begin thinking about what tool or pattern we introduce to replace Rectify.

@Jonic Jonic self-assigned this Aug 15, 2023
Copy link

@ronanduddy ronanduddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👍, can we bump to 0.14.1?

@Jonic
Copy link
Author

Jonic commented Aug 15, 2023

Nice one 👍, can we bump to 0.14.1?

@ronanduddy No need to. We haven't released 0.14.0 yet. Just because code is in master doesn't necessarily mean it's released. It's quite normal for dependencies to treat master as the next version, so we can add things here until we're ready to release 0.14.0, at which point we will create a tag for the new release, and then we can install it in Panacea's Gemfile.

So basically once this merges, 0.14.0 will be done. I'll get the tag created, and then open a PR to install 0.14.0 on Panacea.

Copy link

@ronanduddy ronanduddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got you @Jonic - I just checked Panacea's Gemfile:

gem "rectify", "~> 0.13", github: "healiosuk/rectify", tag: "v0.13.0"

LGTM

@Jonic Jonic merged commit f335995 into master Aug 15, 2023
@Jonic Jonic deleted the ruby-3-compatibility branch August 15, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants