Skip to content

Instantly share code, notes, and snippets.

Created May 31, 2011 20:28
Show Gist options
  • Save anonymous/1001207 to your computer and use it in GitHub Desktop.
Save anonymous/1001207 to your computer and use it in GitHub Desktop.
require 'terminal-table/import'
array = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
t = table do
array.each do |a|
add_row a
end
end
puts t
results = []
while !array.empty?
# first row
results << array.slice!(0)
# rotate
array = array.transpose.reverse
end
p results.flatten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment