module Norma43::Utils::StringHelpers

Public Class Methods

underscore(word) click to toggle source
# 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