Program and File Interaction

As you saw yesterday, Ruby finds methods by following certain rules, expecting the program to be arranged in a certain way. Ruby also has some expectations when it tries to locate the source of its programming instructions.

What that slick segue means is that we're going to take up the topic of program file layout, storage, and retrieval. This constitutes part of “program organization” in the broad (some might say sprawling) sense that we've defined that term.

In most cases, Ruby receives programming instructions by reading in one or more disk files. (As you know from using irb, that isn't the only possibility, but that's our focus here.) You already know about the “one” in “one or more disk files” because each of ...

Get Sams Teach Yourself Ruby in 21 Days 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.