Guest User

Untitled

a guest
Jan 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. def columnize list, cols = 3, width = ENV['COLUMNS'].to_i
  2. list.size.times { |i|
  3. next if i%cols != 0
  4. cols.times { |x|
  5. break unless list[i+x]
  6. print list[i+x][0,width/cols].ljust(width/cols)
  7. }
  8. puts
  9. }
  10. end
Add Comment
Please, Sign In to add comment