# File lib/main/util.rb, line 40 def columnize buf, opts = {} width = Util.getopt 'width', opts, 80 indent = Util.getopt 'indent', opts indent = Fixnum === indent ? (' ' * indent) : "#{ indent }" column = [] words = buf.split %r/\s+/o row = "#{ indent }" while((word = words.shift)) if((row.size + word.size) < (width - 1)) row << word else column << row row = "#{ indent }" row << word end row << ' ' unless row.size == (width - 1) end column << row unless row.strip.empty? column.join "\n" end