Module: ToSlug
- Defined in:
- lib/motr/mods/sluggable.rb
Overview
Original implementation by Ludo van den Boom’s to_slug plugin
Instance Method Summary collapse
-
#to_slug ⇒ Object
:nodoc:.
Instance Method Details
#to_slug ⇒ Object
:nodoc:
55 56 57 58 59 60 61 62 63 |
# File 'lib/motr/mods/sluggable.rb', line 55 def to_slug value = self.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '').to_s value.gsub!(/[']+/, '') value.gsub!(/\W+/, ' ') value.strip! value.downcase! value.gsub!(' ', '-') value end |