Class: DevSuite::Utils::Table::Formatter::ColumnWidthCalculator
- Inherits:
-
Object
- Object
- DevSuite::Utils::Table::Formatter::ColumnWidthCalculator
- Defined in:
- lib/dev_suite/utils/table/formatter/column_width_calculator.rb
Class Method Summary collapse
Class Method Details
.calculate(columns, rows) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/dev_suite/utils/table/formatter/column_width_calculator.rb', line 9 def calculate(columns, rows) column_widths = columns.map { |column| column.name.length } rows.each do |row| row.data.each_with_index do |cell, index| column_widths[index] = [column_widths[index], cell.to_s.length].max end end column_widths end |