Skip to content

Commit

Permalink
Fixed performance issue with large number of rows
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaoru Maeda authored and aptinio committed Apr 15, 2013
1 parent 6caabda commit b3b6964
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/text-table/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def all_text_table_rows #:nodoc:
end

def column_widths #:nodoc:
@column_widths ||= \
all_text_table_rows.reject {|row| row.cells == :separator}.map do |row|
row.cells.map {|cell| [(cell.value.length/cell.colspan.to_f).ceil] * cell.colspan}.flatten
end.transpose.map(&:max)
Expand Down

0 comments on commit b3b6964

Please sign in to comment.