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

Feature/key transform #45

Merged
merged 2 commits into from
Feb 6, 2018
Merged

Feature/key transform #45

merged 2 commits into from
Feb 6, 2018

Conversation

shishirmk
Copy link
Collaborator

@shishirmk shishirmk commented Feb 4, 2018

This pull request the adds the key_transform functionality available in AMS. You can transform the keys and record types using 4 transforms. camel, camel_lower, underscore, dash.

This should address the question/feature request in #41

Additionally this is not backward compatible to use_hyphen. So we will have to bump up the version number accordingly.

@shishirmk shishirmk force-pushed the feature/key_transform branch from 7808f84 to cb624bd Compare February 4, 2018 21:21
@NullVoxPopuli
Copy link

I have a gem (that AMS(, and maybe others? Use)) called case_transform. It also has a native extension counterpart called case_transform-rust-extensions, which reduce conversion time by ~20x depending on the transform.

@shishirmk
Copy link
Collaborator Author

shishirmk commented Feb 4, 2018

@NullVoxPopuli Thanks for the suggestion. This is happening during class initialization so it shouldn't affect the serialization time. We are avoiding gems with native extensions for now. Here is a pull request where i have only two gems as runtime dependencies #40

This was referenced Feb 4, 2018
@shishirmk shishirmk merged commit fa33201 into dev Feb 6, 2018
@shishirmk shishirmk deleted the feature/key_transform branch February 6, 2018 06:39
set_key_transform :camel # "some_key" => "SomeKey"
set_key_transform :camel_lower # "some_key" => "someKey"
set_key_transform :dash # "some_key" => "some-key"
set_key_transform :underscore # "some_key" => "some_key"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, the fastest key transform in AMS is :unaltered :)

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.

5 participants