CHAPTER 14

image

Input/Output

Input/Output within Ruby is the ability to bi-directionally communicate between Ruby and an external resource, such as a file or network resource. It is worth noting that Input/Output is not just restricted to File processes, as often wrongly assumed. Ruby Input/Output is defined from the single base class IO. Derived from the IO class, we then have more specialized, but otherwise similar subclasses, such as File and BasicSocket that deal with the Input/Output for the particular type of resource.

Previously, we have dealt with Standard Input/Output, which allows us to communicate interactively with the user running our ...

Get Ruby Quick Syntax Reference 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.