Chapter 12. File, I/O, and system operations

 

In this chapter

  • Keyboard input and screen output
  • File operations
  • Standard library file facilities
  • The StringIO class

 

The topics in this chapter—keyboard I/O, files, and system commands—are united by the fact that they operate on entities that aren’t, strictly speaking, objects. They take you outside the bounds of the program’s memory space, and into your hardware and/or your operating system.

At the same time, one of the first things you’ll notice about most of these operations is that Ruby keeps them object oriented. Input and output streams, like the standard input stream or, for that matter, any file handle, are objects. Some I/O-related commands are more procedural: puts, for example, ...

Get The Well-Grounded Rubyist 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.