Class: Indocker::StringUtils
- Inherits:
-
Object
- Object
- Indocker::StringUtils
- Defined in:
- lib/indocker/utils/string_utils.rb
Class Method Summary collapse
Class Method Details
.underscore(word) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/indocker/utils/string_utils.rb', line 2 def self.underscore(word) word = word.dup word.gsub!(/::/, '/') word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') word.tr!("-", "_") word.downcase! word end |