Source Code for
The Ruby Way
Version 1.0
5 April 2002
About this archive
- The contents of the Windows and UNIX versions of this
archive are essentially identical.
- One difference is the use of a .tar.gz file for UNIX and a
.ZIP for Windows.
- Another is that I have tried to use the "native" end-of-line
character for each platform.
- There are code fragments here that are OS-specific, but they
are all reproduced together.
- In case of errors in this archive, please contact
the author,
Hal Fulton,
directly.
File naming conventions
- Chapters 2 through 9 are represented by the directories
ch2 through ch9.
- The files here are (for the most part) named according to
this format pNNN where NNN is the page number
in the text. Example: p81.rb
- Note:In a directory listing, the files will not necessarily
appear in numerical order.
- In some cases there may be a letter appended (when there is
more than one code fragment on a page). Example: p124a.rb
- When the code fragment is an actual numbered listing, the listing
number will be appended after a lowercase "l" (with the dot converted
to a hyphen). Examples: p92l2-6.rb and p124bl2-9
- Many of the filenames are NOT "8 dot 3" as Windows users might expect.
This should not cause problems even for Windows users.
- In some cases, it made sense to preserve the "original" name of the
file. This is done, for example, when the filename
is referenced from another related fragment. In this case, the "canonical"
file (e.g., p442.rb will usually just be a placeholder that names
the real file (e.g., params.rb).
- Some of the files are not Ruby code and thus may have other extensions
such as .xml or .html (embedded Ruby files are given the
extension .erb).
What's here?
- Every numbered code listing is here (2.1 through 9.20).
- Many smaller fragments are also included (more than two hundred of them).
What's not here?
- There is no code from Chapter 1 or the appendices. These fragments are
in general less significant than most of the others.
- The shorter, less important fragments were omitted.
- Listing 9.13 was omitted, as it is not actually code.
- Code that couldn't possibly run (e.g., with embedded pseudocode or with
nonexistent resources) was usually omitted.
- In some cases, adjacent fragments may have been lumped together into one
single fragment (if they were short enough and closely related).
What doesn't work?
- All the code has been tested, but there may still be bugs or errors that
crept in during publishing.
- The code here is (supposedly) consistent with the initial version of the
errata for the book, and thus may differ slightly from the first printing.
- Certain pieces of code will run only on the Windows family of operating
systems or only on the UNIX family.
- Some code fragments have dependencies on prior code fragments. The content
of the file usually does not reflect this, but the book's text will. (Some of
the binary tree examples in Chapter 3 are especially problematic.)
- Some of the examples depend on "imaginary" resources such as files,
directories, URLs, IP names, user names, and so on. These will typically not
work without minor changes.
- There may be minor variations in the behavior of different versions of
Ruby (and even different builds, e.g., Cygwin versus MinGW).