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

Fix "Hash.new with kwargs" error in Ruby 3.4 #1761

Closed
wants to merge 1 commit into from

Conversation

amatsuda
Copy link
Member

@amatsuda amatsuda commented Sep 1, 2024

Description

Calling Hash.new with keyword arguments has been removed in Ruby 3.4, and it's warned to "use Hash.new({ key: value }) instead" in Ruby 3.3.
Please see https://bugs.ruby-lang.org/issues/19236 for more details about this change.

So here's a patch that fixes the warning and error below:

Ruby 3.3

warning: Calling Hash.new with keyword arguments is deprecated and will be removed in Ruby 3.4; use Hash.new({ key: value }) instead

Ruby 3.4

unknown keywords: :strict, :proc (ArgumentError)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • CHANGELOG.md has been updated

@amatsuda amatsuda changed the title Hash.new with kwargs has been removed in Ruby 3.4 Fix "Hash.new with kwargs" error in Ruby 3.4 Sep 1, 2024
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

Thank you @amatsuda! Oh, wait #1757 does a different tack - perhaps this is a duplicate effort.

@amatsuda
Copy link
Member Author

amatsuda commented Sep 2, 2024

Oh, indeed. I'm sorry for the noise!

@amatsuda amatsuda closed this Sep 2, 2024
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