Sha256: 2aa1e7b66efbd31fe5c35812ee93f56f744c83a89faaaefe4a4d2d80ff799bdf
Contents?: true
Size: 772 Bytes
Versions: 4
Compression:
Stored size: 772 Bytes
Contents
module Terminal class Table private def recalc_column_widths row return if row.is_a? Separator i = 0 row.cells.each do |cell| colspan = cell.colspan cell_value = cell.value_for_column_width_recalc colspan.downto(1) do |j| # cell_length = cell_value.to_s.length cell_length = cell_value.to_s.display_width if colspan > 1 spacing_length = cell_spacing * (colspan - 1) length_in_columns = (cell_length - spacing_length) cell_length = (length_in_columns.to_f / colspan).ceil end if @column_widths[i].to_i < cell_length @column_widths[i] = cell_length end i = i + 1 end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems