TableKitty (TableKitty v0.1.0)

View Source

Documentation for TableKitty.

Summary

Functions

Builds IO data with the generated table.

Print the table if the same is valid.

Functions

build(tabular, opts \\ [])

@spec build(Table.Reader.t(), Keyword.t()) ::
  {:ok, IO.chardata()} | {:error, Exception.t()}

Builds IO data with the generated table.

This function receives a valid tabular data, like a list of maps, or a keyword list with keys as column names and values as list of values for each column.

Examples

iex> {:ok, iodata} = TableKitty.build([a: [1, 2], b: [4, 6]])
iex> IO.iodata_to_binary(iodata)
"""
+---+---+
| a | b |
+===+===+
| 1 | 4 |
+---+---+
| 2 | 6 |
+---+---+
"""

iex> {:ok, iodata} = TableKitty.build([%{a: 1, b: 4}, %{a: 2, b: 6}])
iex> IO.iodata_to_binary(iodata)
"""
+---+---+
| a | b |
+===+===+
| 1 | 4 |
+---+---+
| 2 | 6 |
+---+---+
"""

print(tabular, opts \\ [])

@spec print(Table.Reader.t(), Keyword.t()) :: :ok | {:error, Exception.t()}

Print the table if the same is valid.

To see options go to build/2.