Module: Norma43::Utils::StringHelpers
- Defined in:
- lib/norma43/utils/string_helpers.rb
Class Method Summary collapse
Class Method Details
.underscore(word) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/norma43/utils/string_helpers.rb', line 6 def self.underscore(word) word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2') word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') word.tr!("-", "_") word.downcase end |