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 Ruby 3.1 #freeze #75

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

Richard-Degenne
Copy link
Contributor

Fixes #74.

I played around with the first solution I proposed there, i.e. defining all methods during the initialization by using super, but there are some behaviors of RecursiveOpenStruct that were too specific to make it work, like the preserve_original_keys option. The original implementation simply converts every key to a Symbol.

So I went with the second option: override Object#freeze to create all methods before freezing the object itself.

The gem could also provide a #deep_freeze that would freeze the object, as well as all its sub-elements, recursively.

@aetherknight
Copy link
Owner

LGTM, apologies on the delay for getting this reviewed and added.

@aetherknight aetherknight merged commit adc698c into aetherknight:main Jun 19, 2024
@Richard-Degenne Richard-Degenne deleted the fix/ruby-3.1-freeze branch June 26, 2024 09:36
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.

RecursiveOpenStruct#freeze does not play nice with Ruby 3.1
2 participants