Part 1. Ruby foundations

The goal of this part of the book is to give you a broad but practical foundation layer on which to build, and to which to anchor, the further explorations of Ruby that follow in parts 2 and 3. We’ll start with a chapter on bootstrapping your Ruby literacy; after working through that first chapter, you’ll be able to run Ruby programs comfortably and have a good sense of the layout of a typical Ruby installation. Starting with chapter 2, we’ll get into the details of the Ruby language. Ruby is an object-oriented language, and the sooner you dive into how Ruby handles objects, the better. Accordingly, objects will serve both as a way to bootstrap the discussion of the language (and your knowledge of it) and as a golden thread leading us to further topics and techniques.

Objects are created by classes, and in chapter 3 you’ll learn how classes work. The discussion of classes is followed by a look at modules in chapter 4. Modules allow you to fine-tune classes and objects by splitting out some of the object design into separate, reusable units of code. To understand Ruby programs—both your own and others’—you need to know about Ruby’s notion of a current default object, known by the keyword self. Chapter 5 will take you deep into the concept of self, along with a treatment of Ruby’s handling of variable visibility and scope.

In chapter 6, the last in this part of the book, you’ll learn about control flow in Rubyprograms—that is, how to steer the Ruby interpreter through conditional (if) logic, how to loop repeatedly through code, and even how to break away from normal program execution when an error occurs. By the end of chapter 6, you’ll be thinking along with Ruby as you write and develop your code.

The title of this part is “Ruby foundations,” which obviously suggests that what’s here is to be built on later. And that’s true. But it doesn’t mean that the material in part 1 isn’t important in itself. As you’ll see once you read them, these six chapters present you with real Ruby techniques, real code, and information you’ll use every time you write or execute a Ruby program. It’s not the “foundations” because you’ll learn it once and then ignore it, but because there’s so much more about Ruby yet to follow!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.139.167