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

Michaelherold dash nil keys #554

Merged
merged 4 commits into from Nov 8, 2021

Conversation

dblock
Copy link
Member

@dblock dblock commented Nov 8, 2021

Merging #535

michaelherold and others added 4 commits October 22, 2020 20:51
The check here doesn't make sense because it's testing the behavior of
another method. The best way to check identity is but checking the
`#object_id` of an object - thus, this check actually does what the test
says it does.
In some cases --- like writing meta-extensions of `IndifferentAccess`
--- we need access to the ability to convert a key for the purposes of
`IndifferentAccess`. Exposing this behavior as a module function makes
this possible.
When exporting a Dash via `#to_h` or `#to_hash`, we expect all
properties to be exported whether or not they are set. However, in the
change that allows codependent properties to be nilified, we regressed
the behavior of exporting all properties.

There is a gotcha here, which I note in the tests for the specs. For
posterity, MRI does not send the `#to_hash` method to anything that
subclasses `Hash` when you double-splat it. Thus, we cannot override the
behavior within MRI. For more information, see [this comment][1] where I
detail the behavior of double-splat within MRI.

Currently, JRuby also follows this behavior, but it's not guaranteed
that other Rubies will.

[1]: hashie#353 (comment)
@dblock dblock merged commit f682d66 into hashie:master Nov 8, 2021
@dblock dblock deleted the michaelherold-dash-nil-keys branch November 8, 2021 03:24
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.

None yet

2 participants