Chapter 2Processing Standard Input
We’ve looked at how we can use Ruby to read data that exists on the filesystem. Another common source of information, though, is direct input to a script. This might be text that users input using their keyboard, or it might be text that’s redirected to your script from another process. From the perspective of Ruby, these two different types of input are actually the same thing, processed in the same way.
This source of input is called standard input, and it’s one of the foundations of text processing. Along with its output equivalents standard output and standard error, it enables different programs to communicate with one another in a way that doesn’t rely on complex protocols or unintelligible binary data, ...
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