Sha256: df672029acd2bbbcf75a2244706cf083abc7d4aa337f33c434bd47664d34ae6b
Contents?: true
Size: 604 Bytes
Versions: 4
Compression:
Stored size: 604 Bytes
Contents
module CoreExtensions module String def slugorize result = self.downcase result.gsub!(/&([0-9a-z#])+;/, '') # Ditch Entities result.gsub!('&', 'and') # Replace & with 'and' result.gsub!(/[^a-z0-9\-']/, '-') # Get rid of anything we don't like result.gsub!(/-+/, '-') # collapse dashes result.gsub!(/-$/, '') # trim dashes result.gsub!(/^-/, '') # trim dashes result end def slugorize! self.replace(self.slugorize) end end end String.send(:include, CoreExtensions::String)
Version data entries
4 entries across 4 versions & 1 rubygems