Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/formatters/snake.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) snake(column_count)
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/formatters/snake.rb', line 3 def snake column_count snake = [] row_count = (size.to_f / column_count).ceil row_count.times do |row_index| snake[row_index] = [] column_count.times do |column_index| snake[row_index][column_index] = self[row_index + column_index * row_count] end end snake end |