# File lib/kwalify/util.rb, line 19 def untabify(str, width=8) return str if str.nil? list = str.split(/\t/, -1) # if 2nd arg is negative then split() doesn't remove tailing empty strings last = list.pop sb = '' list.each do |s| column = (n = s.rindex(?\n)) ? s.length - n - 1 : s.length n = width - (column % width) sb << s << (' ' * n) end sb << last if last return sb end