Sha256: 633ecc5ef8a815357a8067e875105ee0ff91332e6ba083613c2acfe619772a38

Contents?: true

Size: 279 Bytes

Versions: 33

Compression:

Stored size: 279 Bytes

Contents

class String
  def to_permalink
    str = ActiveSupport::Multibyte::Chars.new(self.dup)
    str = str.normalize(:kd).gsub(/[^\x00-\x7F]/,'').to_s
    str.gsub!(/[^-\w\d]+/xim, "-")
    str.gsub!(/-+/xm, "-")
    str.gsub!(/^-?(.*?)-?$/, '\1')
    str.downcase!
    str
  end
end

Version data entries

33 entries across 33 versions & 3 rubygems

Version Path
kitabu-2.1.0 lib/kitabu/extensions/string.rb
bookmaker-0.7.0.pre9 lib/bookmaker/extensions/string.rb
bookmaker-0.7.0.pre5 lib/bookmaker/extensions/string.rb
bookmaker-0.7.0.pre4 lib/bookmaker/extensions/string.rb
bookmaker-0.7.0.pre3 lib/bookmaker/extensions/string.rb
kitabu-2.0.4 lib/kitabu/extensions/string.rb
kitabu-2.0.3 lib/kitabu/extensions/string.rb
kitabu-2.0.2 lib/kitabu/extensions/string.rb
kitabu-2.0.1 lib/kitabu/extensions/string.rb
kitabu-2.0.0 lib/kitabu/extensions/string.rb
bookmaker-0.6.0 lib/bookmaker/extensions/string.rb
kitabu-1.0.6 lib/kitabu/extensions/string.rb
kitabu-1.0.5 lib/kitabu/extensions/string.rb
bookshelf-1.2.1 lib/bookshelf/extensions/string.rb
bookshelf-1.2.0 lib/bookshelf/extensions/string.rb
bookshelf-1.1.0 lib/bookshelf/extensions/string.rb
bookshelf-1.0.0 lib/bookshelf/extensions/string.rb
bookmaker-0.5.5 lib/bookmaker/extensions/string.rb
kitabu-1.0.4 lib/kitabu/extensions/string.rb
kitabu-1.0.3 lib/kitabu/extensions/string.rb