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

symbolize_names is a confusing method name #370

Open
CodingAnarchy opened this issue Jan 10, 2019 · 1 comment
Open

symbolize_names is a confusing method name #370

CodingAnarchy opened this issue Jan 10, 2019 · 1 comment

Comments

@CodingAnarchy
Copy link

The symbolize_names option is confusing and out of sync with the rest of the Ruby standard library. For instance, the Hash class uses symbolize_keys as a method. It seems that "name" is only used in JSON documentation (where things are referred to as "name-value" pairs instead of "key-value" pairs). This is, I believe, intended to indicate that the key has to be a string, but when dealing with Ruby parsing it is confusing to remember that only the JSON library has a different name.

Is there any way we can add an alias to the option as symbolize_keys?

@flori flori pinned this issue Jun 21, 2019
@esotericpig
Copy link

As a side note, YAML also calls it symbolize_names, so probably YAML (Psych) would also need to be updated.

YAML.safe_load(data,symbolize_names: true)

So at the very least, JSON and YAML (for symbolize_names) are consistent with each other.

@hsbt hsbt unpinned this issue Oct 18, 2021
Repository owner deleted a comment from mick03131 Jan 18, 2023
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

No branches or pull requests

2 participants