Module: PCurtail

Defined in:
lib/pcurtail.rb

Class Method Summary collapse

Class Method Details

.do(p, len) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# 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