Sha256: 842eb69b15317c490c4abc071caac785c3c286a75cef087287557a78001c7c6e
Contents?: true
Size: 319 Bytes
Versions: 8
Compression:
Stored size: 319 Bytes
Contents
module Dao class Slug < ::String def Slug.for(*args) string = args.flatten.compact.join('-') words = string.to_s.scan(%r/\w+/) words.map!{|word| word.gsub(%r/[^0-9a-zA-Z_-]/, '')} words.delete_if{|word| word.nil? or word.strip.empty?} new(words.join('-').downcase) end end end
Version data entries
8 entries across 8 versions & 1 rubygems