diff options
| author | Grant Ammons <gammons@gmail.com> | 2017-10-03 07:20:02 -0400 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2017-10-03 07:20:41 -0400 |
| commit | 08deecf1954f6cf748812057ba5cdd9a0425bfc9 (patch) | |
| tree | 722ccf48c7a204af8d508c2f2757f673f771915b /memory_printer.go | |
| parent | 0840e7a147d8594acec63fd1ce8aba9e15472839 (diff) | |
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.
Diffstat (limited to 'memory_printer.go')
| -rw-r--r-- | memory_printer.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/memory_printer.go b/memory_printer.go new file mode 100644 index 0000000..62eaa83 --- /dev/null +++ b/memory_printer.go @@ -0,0 +1,9 @@ +package todolist + +type MemoryPrinter struct { + Groups *GroupedTodos +} + +func (m *MemoryPrinter) Print(groupedTodos *GroupedTodos, printNotes bool) { + f.Groups = groupedTodos +} |
