From 08deecf1954f6cf748812057ba5cdd9a0425bfc9 Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Tue, 3 Oct 2017 07:20:02 -0400 Subject: Refactor the formatter to an interface and rename it This change refactors the formatter to be an interface called Printer. `NewApp` will use the functionality of `ScreenPrinter`, which is what I refactored the old `Formatter` class into. There is a new class the implements the `Printer` interface called `MemoryPrinter`, which will simply store the `groups` as they were passed to it. This will allow tests in `app_test.go` to become much more powerful, since `App` no longer needs to be tightly coupled to printing to the screen. --- todolist/printer.go | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 todolist/printer.go (limited to 'todolist/printer.go') diff --git a/todolist/printer.go b/todolist/printer.go new file mode 100644 index 0000000..805cc6e --- /dev/null +++ b/todolist/printer.go @@ -0,0 +1,5 @@ +package todolist + +type Printer interface { + Print(*GroupedTodos, bool) +} -- cgit v1.3