0.01
No commit activity in last 3 years
No release in over 3 years
Transforms string letter case to camel, snake,dash and underscore without activesupport dependencies. Forked from https://github.com/rails-api/case_transform
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.7.0
~> 0.1.0
>= 2.2.30
~> 2.18.0
~> 4.7.3
~> 0.14.1
>= 13.0.6
~> 1.22
~> 0.17.1
 Project Readme
  • case_transform2
    • Why
    • Install
    • Warning
    • Usage
    • Transforms
    • NOTE

case_transform2

Maintainability Audit Test Test Coverage

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

Ruby Version Support

See .github/workflows/github-actions.yml to find out the latest Ruby version support The target is above 2.5 and above

License: See LICENSE.txt file