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

Change `symbolize_names` to `symbolize_keys` #341

Open
stomar opened this issue Dec 1, 2017 · 5 comments

Comments

@stomar
Copy link
Contributor

@stomar stomar commented Dec 1, 2017

This occured to me while testing this option without the docs in front of me; it didn't work because I thought the option was named symbolize_keys (and only one day before I wrote the docs for it...). Why symbolize_names? symbolize_keys describes exactly what it does, symbolizing Hash keys, not names. Also, symbolize_keys already has some spread as a method name.

I will provide a PR if there is agreement on this.

@stomar

This comment has been minimized.

Copy link
Contributor Author

@stomar stomar commented Dec 3, 2017

@k0kubun

This comment has been minimized.

Copy link
Member

@k0kubun k0kubun commented Dec 3, 2017

That's because JSON has such interface.

JSON.parse(json, symbolize_names: true)
@stomar

This comment has been minimized.

Copy link
Contributor Author

@stomar stomar commented Dec 3, 2017

I see. But I don’t think that consistency with JSON is a good enough justification for a poorly named option (and the only option they have in common). symbolize_keys is more to the point and used in other places (e.g. Rails provides a Hash#symbolize_keys method).

BTW, the docs for JSON need to explain(!) what „names“ means: “returns symbols for the names (keys) in a JSON object“; and: hashes have keys, not names.

@baweaver

This comment has been minimized.

Copy link

@baweaver baweaver commented Jan 16, 2019

I've opened this as an issue on the Ruby bug-tracker, as I agree that the current name is not clear:

https://bugs.ruby-lang.org/issues/15541

@noraj

This comment has been minimized.

Copy link

@noraj noraj commented Oct 14, 2019

Rather than changing the name (breaking change) just create an alias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.