Skip to content

Run CI against Ruby 3.2#742

Merged
ixti merged 2 commits intohttprb:mainfrom
koheisg:ruby-3-2
Apr 10, 2023
Merged

Run CI against Ruby 3.2#742
ixti merged 2 commits intohttprb:mainfrom
koheisg:ruby-3-2

Conversation

@koheisg
Copy link
Copy Markdown
Contributor

@koheisg koheisg commented Mar 24, 2023

No description provided.

@koheisg koheisg changed the title Ruby 3 2 Run CI against Ruby 3.2 Mar 24, 2023
Comment on lines +17 to +21
x = if RUBY_VERSION >= "3.2.0"
Data.define(:to_hash).new(:to_hash => { "accept" => "json" })
else
Struct.new(:to_hash).new({ "accept" => "json" })
end
Copy link
Copy Markdown
Contributor Author

@koheisg koheisg Mar 24, 2023

Choose a reason for hiding this comment

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

Suggested change
x = if RUBY_VERSION >= "3.2.0"
Data.define(:to_hash).new(:to_hash => { "accept" => "json" })
else
Struct.new(:to_hash).new({ "accept" => "json" })
end
Struct.new(:to_hash, keyword_init: false).new("accept" => "json")

If this is the case, the code will not branch by version, but keyword_init: false will cause rubocop to say `Use hash rockets syntax.

@tarcieri
Copy link
Copy Markdown
Member

@koheisg a separate issue, but it's probably about time we changed from hashrockets to keyword args in general

@koheisg
Copy link
Copy Markdown
Contributor Author

koheisg commented Mar 25, 2023

@tarcieri OK ruby 3.2 support first! Thanks.

@ixti ixti merged commit 4e0696c into httprb:main Apr 10, 2023
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.

3 participants