Sha256: cc056335e89dcb9766d510a39fbde1689a0458176e214ee13be13f5b28b74601
Contents?: true
Size: 466 Bytes
Versions: 5
Compression:
Stored size: 466 Bytes
Contents
# TODO: Replace with facets/string/unfold class String # def unfold_paragraphs blank = false text = '' split(/\n/).each do |line| if /\S/ !~ line text << "\n\n" blank = true else if /^(\s+|[*])/ =~ line text << (line.rstrip + "\n") else text << (line.rstrip + " ") end blank = false end end text = text.gsub("\n\n\n","\n\n") return text end end
Version data entries
5 entries across 5 versions & 2 rubygems