Wrapping Up
We’ve looked at two different techniques in this chapter, one used more frequently than the other, but both useful in their way. First, we explored how to write to other processes, allowing us to leverage the power of existing utilities within our scripts. We then looked at how we could use this in combination with redirecting our own standard output stream, in this case to page the output from our script.
Then we looked at writing to files, which, while straightforward, is the single most common task we face when wanting to write data somewhere. We also looked at the Ruby standard library’s capacity to create temporary files that are cleaned up after our script finishes its execution.
Now that we’ve looked at the mechanisms of writing, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access