O'Reilly logo

The Well-Grounded Rubyist by David A. Black

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required