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

Implement Date#deconstruct_keys and DateTime#deconstruct_keys #80

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

zverok
Copy link
Contributor

@zverok zverok commented Dec 6, 2022

Same as ruby/ruby#6594, but for Date & DateTime.

@zverok
Copy link
Contributor Author

zverok commented Dec 6, 2022

Hmm, interesting, it seems to only be compilable under 3.2 🤔
Should I surround new code with a version-specific macro?

@jeremyevans
Copy link
Contributor

Sorry that I haven't had a chance to review this yet, I'm currently at RubyConfTH and haven't had a lot of free time. I should be able to review next week.

From a brief review of the build error, you can probably switch from rb_hash_new_capa to just rb_hash_new. Unless you can see a significant performance improvement from using rb_hash_new_capa on 3.2, I would avoid the optimization and keep the code the same for all ruby versions.

@zverok
Copy link
Contributor Author

zverok commented Dec 10, 2022

@jeremyevans Yeah, makes sense. All green now.

Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for working on this. I have some minor requests for changes, then this can be merged.

ext/date/date_core.c Outdated Show resolved Hide resolved
test/date/test_date.rb Show resolved Hide resolved
@zverok zverok merged commit c03663c into ruby:master Dec 13, 2022
@zverok zverok deleted the deconstruct_keys branch December 13, 2022 19:52
matzbot pushed a commit to ruby/ruby that referenced this pull request Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants