View Source IO.ANSI.Table.Spec.ColumnWidths (IO ANSI Table v1.0.34)

Derives the column widths of a table.

Summary

Functions

Derives the column widths of a table.

Functions

@spec derive_and_put(IO.ANSI.Table.Spec.t()) :: IO.ANSI.Table.Spec.t()

Derives the column widths of a table.

Examples

iex> alias IO.ANSI.Table.Spec.{ColumnWidths, Headings, Rows}
iex> alias IO.ANSI.Table.Spec
iex> spec = Spec.new([:c4, :c1, :c2])
iex> maps = [%{c1: 11, c2: 12, c4: 14}, %{c1: 21, c2: 22, c4: :r2c4}]
iex> spec = Headings.derive_and_put(spec)
iex> spec = Rows.derive_and_put(spec, maps)
iex> spec = ColumnWidths.derive_and_put(spec)
iex> %Spec{column_widths: column_widths} = spec
iex> column_widths
[4, 2, 2]