Skip to content

Adding '**' to make opts ruby 3.2+ compliant#68

Merged
ShreyaThapa merged 1 commit into
Dwolla:mainfrom
onrampfunds:main
Mar 15, 2023
Merged

Adding '**' to make opts ruby 3.2+ compliant#68
ShreyaThapa merged 1 commit into
Dwolla:mainfrom
onrampfunds:main

Conversation

@peterb-onramp

Copy link
Copy Markdown
Contributor

def initialize opts
opts[:id] ||= opts[:key]
raise ArgumentError.new ":key is required" unless opts[:id].is_a? String
is not ruby 3.2+ keywords compliant.

https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/

Methods taking a rest parameter (like *args) and wishing to delegate keyword arguments through foo(*args) must now be marked with ruby2_keywords (if not already the case). In other words, all methods wishing to delegate keyword arguments through *args must now be marked with ruby2_keywords, with no exception. This will make it easier to transition to other ways of delegation once a library can require Ruby 3+. Previously, the ruby2_keywords flag was kept if the receiving method took *args, but this was a bug and an inconsistency. A good technique to find potentially missing ruby2_keywords is to run the test suite, find the last method which must receive keyword arguments for each place where the test suite fails, and use puts nil, caller, nil there. Then check that each method/block on the call chain which must delegate keywords is correctly marked with ruby2_keywords

To fix we add the '**' before the opts parameter and this resolved the issue.

@ShreyaThapa ShreyaThapa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR, @peterb-onramp! We are grateful for your time and effort. We've reviewed and approved the changes. We will merge into the main branch and include in the next release.

Thanks again for your contributions and for being a part of our community!

@ShreyaThapa ShreyaThapa merged commit 450e7bc into Dwolla:main Mar 15, 2023
@ShreyaThapa ShreyaThapa linked an issue Mar 15, 2023 that may be closed by this pull request
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.

Ruby 3.2+ Keywords Error In Lib/Client.rb

2 participants