-
Notifications
You must be signed in to change notification settings - Fork 0
Object Utility Methods
andela-oojewale edited this page Jan 14, 2016
·
1 revision
The following method add extra functionality to certain objects.
-
To_snake_case: converts receiving object(string) to snake case.
TaskManager.to_snake_case = task_manager
-
To_camel_case: converts receiving object(string) to camel case.
task_manager.to_camel_case = TaskManager
-
To_b: Converts string "true" to the boolean equivalent and "false" or anything else to boolean false.
"true".to_b = true
-
Titleize: converts receiving object(string) to title case.
"life is good".titleize = "Life Is Good"
-
Pluralize: turns a singular word that does not end with "s" to plural.
"book".pluralize = "books"