Skip to content

Commit

Permalink
Optimizing table creation (don't re-index all cells every time a cell…
Browse files Browse the repository at this point in the history
… is added)
  • Loading branch information
alexdowad committed Aug 6, 2012
1 parent 9c1ff3b commit 2b424aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/prawn/table/cells.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ def []=(row, col, cell) # :nodoc:
cell.row = row
cell.column = col

@indexed = false
if @indexed
(@rows[row] ||= []) << cell
(@columns[col] ||= []) << cell
@first_row = row if !@first_row || row < @first_row
@first_column = col if !@first_column || col < @first_column
@row_count = @rows.size
@column_count = @columns.size
end

self << cell
end
Expand Down

0 comments on commit 2b424aa

Please sign in to comment.