Transformation: Format the Table
Learn how to format the table in a project.
We'll cover the following
Create formatted table
All that’s left from our design is to create the formatted table. The following would be a nice interface:
def process({user, project, count}) do
Issues.GithubIssues.fetch(user, project)
|> decode_response()
|> sort_into_ascending_order()
|> last(count)
|> print_table_for_columns(["number", "created_at", "title"])
end
We pass the formatter the list of columns to include in the table, and it writes the table to standard output. The formatter doesn’t add any new project- or design-related techniques, so we’ll just show the listing in the table_formatter.ex
file.
And here are the tests for it. Use the mix test
command to run the code below.
Get hands-on with 1400+ tech skills courses.