# `IO.ANSI.Table.Spec`
[🔗](https://github.com/RaymondLoranger/io_ansi_table/blob/main/lib/io/ansi/table/spec.ex#L1)

A table spec struct and functions for the IO ANSI Table app.

The table spec struct contains the following fields:

* initial fields:

  - `spec_name`,
  - `headers`,
  - `align_specs`,
  - `bell`,
  - `count`,
  - `header_fixes`,
  - `margins`,
  - `max_width`,
  - `sort_specs`,
  - `sort_symbols`,
  - `style`

* derived fields:

  - `align_attrs`,
  - `headings`,
  - `left_margin`,
  - `sort_attrs`

* data dependent fields:

  - `column_widths`
  - `rows`

# `t`

```elixir
@type t() :: %IO.ANSI.Table.Spec{
  align_attrs: [IO.ANSI.Table.Header.align_attr()],
  align_specs: [IO.ANSI.Table.Header.align_spec()],
  bell: boolean(),
  column_widths: [IO.ANSI.Table.Column.width()],
  count: integer(),
  header_fixes: %{optional(String.t() | Regex.t()) =&gt; String.t()},
  headers: [IO.ANSI.Table.Header.t(), ...],
  headings: [String.t()],
  left_margin: String.t(),
  margins: keyword(),
  max_width: pos_integer(),
  rows: [IO.ANSI.Table.Row.t()],
  sort_attrs: [IO.ANSI.Table.Header.sort_attr()],
  sort_specs: [IO.ANSI.Table.Header.sort_spec()],
  sort_symbols: [IO.ANSI.Table.Header.sort_symbol()],
  spec_name: String.t(),
  style: IO.ANSI.Table.Style.t()
}
```

A table spec struct for the IO ANSI Table app

# `develop`

```elixir
@spec develop(t()) :: t()
```

Updates the derived fields of `spec`.

# `new`

```elixir
@spec new([IO.ANSI.Table.Header.t(), ...], keyword()) :: t()
```

Creates a table spec struct from `headers` and `options`.

# `spec_name`

```elixir
@spec spec_name(keyword()) :: String.t()
```

Gets the table spec server name in `options`.
Defaults to the current app name expressed as a string.

## Examples

    iex> alias IO.ANSI.Table.Spec
    iex> Spec.spec_name(style: :light, count: 9, spec_name: "github_issues")
    "github_issues"

    iex> alias IO.ANSI.Table.Spec
    iex> Spec.spec_name([])
    "io_ansi_table"

# `write_table`

```elixir
@spec write_table(t(), [Access.container()], keyword()) :: :ok
```

Writes data from `maps` to `:stdio` per table `spec` and `options`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
