Method: String#slugify

Defined in:
lib/henshin/ext.rb

#slugifyString

Turns the string to a slug

Returns:

  • (String)

    the created slug



6
7
8
9
10
11
12
13
14
# File 'lib/henshin/ext.rb', line 6

def slugify
  slug = self.clone
  slug.gsub!(/[']+/, '')
  slug.gsub!(/\W+/, ' ')
  slug.strip!
  slug.downcase!
  slug.gsub!(' ', '-')
  slug
end