module Minislug

Constants

SUBSTITUTIONS
TR0
TR1
VERSION

Public Class Methods

convert_to_slug(txt) click to toggle source
# File lib/minislug.rb, line 29
def self.convert_to_slug txt
  txt = txt.gsub(/ß/, "ss")
  txt = txt.tr TR0, TR1
  SUBSTITUTIONS.each do |reg, rep|
    txt = txt.gsub reg, rep
  end
  txt.gsub(/[^0-9A-Za-z-]/, '').gsub(/^-/, '').gsub(/-$/, '')
end