Method: Bookmaker::Base.to_permalink
- Defined in:
- lib/bookmaker/base.rb
.to_permalink(str) ⇒ Object
269 270 271 272 273 274 |
# File 'lib/bookmaker/base.rb', line 269 def self.to_permalink(str) str = Unicode.normalize_KD(str).gsub(/[^\x00-\x7F]/n,'') str = str.gsub(/[^-_\s\w]/, ' ').downcase.squeeze(' ').tr(' ', '-') str = str.gsub(/-+/, '-').gsub(/^-+/, '').gsub(/-+$/, '') str end |