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

Return a hash with indifferent access rather than a Mash #29

Merged
merged 1 commit into from Jul 5, 2022

Conversation

mboeh
Copy link
Contributor

@mboeh mboeh commented Jun 24, 2022

Problem

1.0.0 resolved #25, but Hashie::Mash is very different from a regular Hash. This causes issues with some existing code. In particular, symbolize_keys no longer works as expected.

Solution

Instead of converting the Setting hash into a Hashie::Mash, instead convert returned values that would be a Hash into a new SettingHash class. This is a normal Hash that has had some Hashie extensions added, notably IndifferentAccess.

Note that if this gem depended on ActiveSupport, I would just call .with_indifferent_access rather than messing with Hashie. It might be worth discussing changing the dependency.

This reduces the scope of the changes made for 1.0.0 while still solving the problem.
@mboeh mboeh requested a review from a team as a code owner June 24, 2022 00:17
@mboeh mboeh merged commit 822d391 into main Jul 5, 2022
@mboeh mboeh deleted the reduce-hashie-scope branch July 5, 2022 20:54
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.

Unexpected [] behavior compared to other access patterns
2 participants