Supporting other IO
We have made quite a few improvements already during the last section: we no longer have to hardcode the input data, and we're better at handling errors coming from jq. But remember how we also wanted to support using our application in a library context? How would someone go about processing the response body of an HTTP response and outputting it to a file if our processor is tightly coupled with terminal-based concepts?
In this section, we're going to address this deficiency by refactoring things again to allow any IO type, not just terminal-based IO types.
The first step in accomplishing this is to re-introduce arguments to Processor#process
: one for the input arguments, input IO, output IO, and error IO. Ultimately, this is going to look like this:
class Transform::Processor def process(input_args : Array(String), input : IO, output : IO, error : IO) : Nil filter = input_args.shift...