Sha256: 417bd1802415693c425016c371f609b13cca2ef474a522e418679ab6aeba2563
Contents?: true
Size: 512 Bytes
Versions: 11
Compression:
Stored size: 512 Bytes
Contents
class String # Adds a newline character unless # this string is empty or already ends with a newline # See https://unix.stackexchange.com/a/18789 def ensure_newline empty? || ends_with?("\n") ? self : self + "\n" end def friendlish I18n.transliterate(self). downcase. gsub(/[^0-9a-z ]/, ''). squish. gsub(' ', '-') end def markdown_paragraphs split(/\n\s*\n/) end def normalize_whitespaces gsub(/([^[:ascii:]])/) { $1.blank? ? ' ' : $1 } end end
Version data entries
11 entries across 11 versions & 1 rubygems