Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def columnize list, cols = 3, width = ENV['COLUMNS'].to_i
- list.size.times { |i|
- next if i%cols != 0
- cols.times { |x|
- break unless list[i+x]
- print list[i+x][0,width/cols].ljust(width/cols)
- }
- puts
- }
- end
Add Comment
Please, Sign In to add comment