https://github.com/rails-api/case_transform
Extraction of the key_transform abilities of ActiveModelSerializers
https://github.com/rails-api/case_transform
Last synced: 8 months ago
JSON representation
Extraction of the key_transform abilities of ActiveModelSerializers
- Host: GitHub
- URL: https://github.com/rails-api/case_transform
- Owner: rails-api
- License: mit
- Created: 2016-09-15T18:14:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-11-06T12:14:33.000Z (about 4 years ago)
- Last Synced: 2024-10-29T12:58:07.194Z (about 1 year ago)
- Language: Ruby
- Size: 24.4 KB
- Stars: 16
- Watchers: 3
- Forks: 8
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# case_transform
Extraction of the key_transform abilities of ActiveModelSerializers
[](https://badge.fury.io/rb/case_transform)
[](https://travis-ci.org/NullVoxPopuli/case_transform)
[](https://codeclimate.com/repos/57dafbcc628330006c001312/feed)
[](https://codeclimate.com/repos/57dafbcc628330006c001312/coverage)
[](https://gemnasium.com/NullVoxPopuli/case_transform)
## Install
```ruby
gem 'case_transform'
```
or
```bash
gem install case_transform
```
And for faster performance, checkout [Case Transform with Native Extensions](https://github.com/NullVoxPopuli/case_transform-rust-extensions)
## Usage
```ruby
require 'case_transform'
CaseTransform.camel_lower(value)
```
`value` can be any of Array, Hash, Symbol, or String.
Any other object type will just be returned.
### Transforms
| | Description |
| --- | --- |
| camel | PascalCase |
| camel_lower | camelCase |
| dash | dash-case |
| underscore | under_score |
| unaltered | pass through |