Module: Cl::Underscore
Instance Method Summary collapse
Instance Method Details
#underscore(string) ⇒ Object
31 32 33 34 35 |
# File 'lib/cl/helper.rb', line 31 def underscore(string) string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). downcase end |