Using the Standard Output and Error Streams Appropriately
In addition to the ability to return a single value to the calling program, all programs have the ability to provide output. The puts method is the primary way of creating output that we’ve seen thus far. We’ve used it to send messages to the terminal. A command line’s output mechanism is actually more sophisticated than this; it’s possible to send output to either of two standard output streams.
By convention, the default stream is called the standard output and is intended to receive whatever normal output comes out of your program. This is where puts sends its argument and where, for example, mysqldump sends the SQL statements that make up the database backup.[31]
The second output ...
Get Build Awesome Command-Line Applications in Ruby 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.