Class: String
Instance Method Summary collapse
-
#hyphenize ⇒ Object
Performs same transformation as underscore, but with hyphens.
Instance Method Details
#hyphenize ⇒ Object
Performs same transformation as underscore, but with hyphens
22 23 24 25 26 27 28 29 |
# File 'lib/active_component/core_extensions.rb', line 22 def hyphenize gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("_", "-"). tr(" ", "-"). downcase end |