Skip to content
Lightweight string letter case transformation for ruby
Branch: master
Clone or download
Pull request Compare This branch is 10 commits ahead of rails-api:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.codeclimate.yml
.gitignore
.rspec
.rubocop.yml
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
Gemfile.lock
Guardfile
LICENSE.txt
README.md
Rakefile
case_transform2.gemspec

README.md

case_transform2

Build Status Test Coverage Maintainability

Transforms string letter case to camel, snake, dash and underscore without activesupport dependencies.
Forked from Rails API CaseTransform gem

Why

We want a simple string method without polluting String class and lightweight.
If you want to use this into Rails application or any Ruby application with activesupport dependencies, you might want to consider the original one instead.

Install

gem 'case_transform2'

or

gem install case_transform2

Warning

if you use 0.x version and want to upgrade to newest version you must rename all CaseTransform to be CaseTransform2

Usage

require 'case_transform2'

value = "hello_world"
CaseTransform2.camel_lower(value) # => helloWorld

value = "hello_world"
CaseTransform2.camel(value) # => HelloWorld

value = "hello_world"
CaseTransform2.dash(value) # => hello-world

value = "helloWorld"
CaseTransform2.underscore(value) # => hello_world

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

NOTE

There is no CaseTransform2.unaltered method like the original gem has

License: See LICENSE.txt file

You can’t perform that action at this time.