Module: Snippit::Slugify
- Included in:
- CLI::Save
- Defined in:
- lib/snippit/slugify.rb
Overview
Provides the slugify function
Instance Method Summary collapse
-
#slugify(str) ⇒ String
Slugify a string.
Instance Method Details
#slugify(str) ⇒ String
Slugify a string
10 11 12 |
# File 'lib/snippit/slugify.rb', line 10 def slugify(str) str.strip.downcase.gsub(/ /, '-').gsub(/[^a-z0-9\-_.]/, '') end |