Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/comfortable_mexican_sofa/extensions/rails.rb
Instance Method Summary collapse
-
#slugify ⇒ Object
Converts string to something suitable to be used as an element id.
Instance Method Details
#slugify ⇒ Object
Converts string to something suitable to be used as an element id
3 4 5 |
# File 'lib/comfortable_mexican_sofa/extensions/rails.rb', line 3 def slugify self.strip.gsub(/\W|_/, '-').gsub(/\s|^_*|_*$/, '').squeeze('-') end |