module PCurtail
Public Class Methods
do(p, len)
click to toggle source
# File lib/pcurtail.rb, line 2 def self.do(p, len) $r = "" for w in p.split if $r.length + w.length > len-3 $r += '...' break else $r += "#{w} " end end return $r end