Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/kitabu/extensions/string.rb
Instance Method Summary collapse
Instance Method Details
#to_permalink ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/kitabu/extensions/string.rb', line 4 def to_permalink str = dup.unicode_normalize(:nfkd) str = str.gsub(/[^\x00-\x7F]/, "").to_s str.gsub!(/[^-\w]+/xim, "-") str.gsub!(/-+/xm, "-") str.gsub!(/^-?(.*?)-?$/, '\1') str.downcase! str end |