# File lib/puppet/application/pi.rb, line 10
10:     def wrap(txt, opts)
11:         return "" unless txt && !txt.empty?
12:         work = (opts[:scrub] ? scrub(txt) : txt)
13:         indent = (opts[:indent] ? opts[:indent] : 0)
14:         textLen = @width - indent
15:         patt = Regexp.new("^(.{0,#{textLen}})[ \n]")
16:         prefix = " " * indent
17: 
18:         res = []
19: 
20:         while work.length > textLen
21:             if work =~ patt
22:                 res << $1
23:                 work.slice!(0, $&.length)
24:             else
25:                 res << work.slice!(0, textLen)
26:             end
27:         end
28:         res << work if work.length.nonzero?
29:         return prefix + res.join("\n" + prefix)
30:     end