Module: Mondo::Utils
Instance Method Summary collapse
-
#camelize(str) ⇒ Object
String Helpers.
- #underscore(str) ⇒ Object
Instance Method Details
#camelize(str) ⇒ Object
String Helpers
8 9 10 |
# File 'lib/api/mondo/utils.rb', line 8 def camelize(str) str.split('_').map(&:capitalize).join end |
#underscore(str) ⇒ Object
12 13 14 |
# File 'lib/api/mondo/utils.rb', line 12 def underscore(str) str.gsub(/(.)([A-Z])/) { "#{$1}_#{$2.downcase}" }.downcase end |