<% @index.first(threshold).each_with_index do |index, pos| %> <%= index %> <% row.at(pos).each do |element| %> <%= element.to_s %> <% end %> <% end %> <% if nrows > threshold %> <% (@vectors.size + 1).times do %> ... <% end %> <% last_index = @index.to_a.last last_row = row_at @index.size-1 %> <%= last_index %> <% last_row.each do |element| %> <%= element.to_s %> <% end %> <% end %>