J
Jakub
Hi there!
(following up the discussion from last year)
This method actually made my life a lot easier when fitting some data
to a table. I had tens of pictures and wanted to show them in rows -
three columns each.
data.each_cons(3) do |column|
column.each do |picture|
show picture
end
end
I was playing with indices, modulos and stuff. After refactoring with
each_cons, the code looked much cleaner.
cheers!
(following up the discussion from last year)
This method actually made my life a lot easier when fitting some data
to a table. I had tens of pictures and wanted to show them in rows -
three columns each.
data.each_cons(3) do |column|
column.each do |picture|
show picture
end
end
I was playing with indices, modulos and stuff. After refactoring with
each_cons, the code looked much cleaner.
cheers!