the blog
Back to -Ruby Programming

The Book Of Ruby

by Huw Collingbourne

Latest update: 18th April, 2009

The Book Of Ruby is a comprehensive free tutorial to the Ruby language. It contains 425 pages in 20 chapters. It is provided in the form of a PDF document in which each chapter is accompanied by ready-to-run source code for all the examples. There is also an Introduction which explains how to use the source code in Ruby In Steel or any other editor/IDE of your choice plus appendices and an index.

The Book Of Ruby is written by Huw Collingbourne - one of the developers of the Ruby In Steel IDE.

Permissions: You may copy or distribute the text and programs of The Book Of Ruby but you may not modify them without prior consent of the author nor may you distribute the eBook in any form other than that in which it is provided. You may not print the text for redistribution. You may, however, print the chapters for your own personal use. In no circumstances may you make a charge for The Book Of Ruby or for any of its component parts.

The Book of Ruby is Copyright © 2009 Huw Collingbourne.

The Little Book Of Ruby: Note that The Book Of Ruby is an in-depth guide to Ruby. For a much simpler guide to the principal features of the Ruby language, we also have the free eBook, The Little Book Of Ruby.


DOWNLOAD

The zip file contains the latest release of The Book Of Ruby (425 pages) plus all source code.

- DOWNLOAD THE BOOK OF RUBY (2.9MB approx)


The Book Of Ruby - Table Of Contents

Introduction
- GETTING STARTED WITH RUBY

  • How To Read This Book
  • Digging Deeper
  • Making Sense Of The Text

- RUBY AND RAILS

  • What Is Ruby?
  • What Is Rails?
  • Download Ruby
  • Get The Source Code Of The Sample Programs
  • Running Ruby Programs
  • The Ruby Library Documentation

Chapter One
- STRINGS, NUMBERS, CLASSES AND OBJECTS

  • Getting and Putting Input
  • Strings and Embedded Evaluation
  • Numbers
  • Testing a Condition: if … then
  • Local and Global Variables
  • Classes and Objects
  • Instance Variables
  • Messages, Methods and Polymorphism
  • Constructors – new and initialize
  • Inspecting Objects

Chapter Two
- CLASS HIERARCHIES, ATTRIBUTES AND CLASS VARIABLES

  • Superclasses and Subclasses
  • Passing Arguments To The Superclass
  • Accessor Methods
  • ‘Set’ Accessors
  • Attribute Readers and Writers
  • Calling Methods of a Superclass
  • Class Variables
    - DIGGING DEEPER
  • Superclasses
  • Constants Inside Classes
  • Partial Classes

Chapter Three
- STRINGS AND RANGES

  • User-Defined String Delimiters
  • Backquotes
  • String Handling
    - DIGGING DEEPER
  • Ranges
  • Iterating With A Range
  • Heredocs
  • String Literals

Chapter Four
- ARRAYS AND HASHES

  • Arrays
  • Creating Arrays
  • Multi-Dimensional Arrays
  • Iterating Over Arrays
  • Indexing Into Arrays
  • Copying Arrays
  • Testing Arrays For Equality
  • Sorting Arrays
  • Comparing Values
  • Array Methods
  • Hashes
  • Creating Hashes
  • Indexing Into A Hash
  • Copying A Hash
  • Sorting A Hash
  • Hash Methods
    - DIGGING DEEPER
  • Treating Hashes As Arrays
  • Appending and Concatenating
  • Matrices and Vectors
  • Sets

Chapter Five
- LOOPS AND ITERATORS

  • For Loops
  • Multiple Iterator Arguments
  • Blocks
  • While Loops
  • While Modifiers
  • Until Loops
  • Loop
    - DIGGING DEEPER
  • The Enumerable Module
  • Custom Comparisons

Chapter Six
- CONDITIONAL STATEMENTS

  • If..Then..Else
  • And..Or..Not
  • If..Elsif
  • Unless
  • If and Unless Modifiers
  • Case Statements
  • The === Method
  • Alternative Case Syntax
    - DIGGING DEEPER
  • Boolean Conditions
  • Negation
  • Eccentricities of Boolean Operators
  • Catch and Throw

Chapter Seven
- METHODS

  • Class Methods
  • Class Variables
  • What Are Class Methods For?
  • Ruby Constructors – new or initialize?
  • Singleton Methods
  • Singleton Classes
  • Overriding Methods
  • public, private and protected
    - DIGGING DEEPER
  • Protected and Private in Descendent Classes
  • Invading The Privacy Of Private Methods
  • Singleton Class Methods
  • Nested Methods
  • Method Names

Chapter Eight
- PASSING ARGUMENTS AND RETURNING VALUES

  • Returning Values
  • Returning Multiple Values
  • Default and Multiple Arguments
  • Assignment and Parameter Passing
  • Integers Are Special
  • The One-Way-In, One-Way-Out Principle
  • Parallel Assignment
    - DIGGING DEEPER
  • By Reference Or By Value?
  • Are Assignments Copies Or References?
  • When Are Two Objects Identical?
  • Parentheses Avoid Ambiguity

Chapter Nine
- EXCEPTION HANDLING

  • Rescue
  • Ensure
  • Else
  • Error Numbers
  • Retry
  • Raise
    - DIGGING DEEPER
  • Omitting begin and end
  • catch…throw

Chapter Ten
- BLOCKS, PROCS AND LAMBDAS

  • What Is A Block?
  • Line Breaks are Significant
  • Nameless Functions
  • Looks Familiar?
  • Blocks and Arrays
  • Procs and Lambdas
  • Creating Objects From Blocks
  • What is a Closure?
  • Yield
  • Blocks Within Blocks
  • Passing Named Proc Arguments
  • Precedence Rules
  • Blocks As Iterators
    - DIGGING DEEPER
  • Returning Blocks From Methods
  • Blocks and Instance Variables
  • Blocks and Local Variables

Chapter Eleven
- SYMBOLS

  • Symbols and Strings
  • Symbols and Variables
  • Why Use Symbols?
    - DIGGING DEEPER
  • What Is A Symbol?

Chapter Twelve
- MODULES AND MIXINS

  • A Module Is Like A Class…
  • Module Methods
  • Modules as Namespaces
  • Module ‘Instance Methods’
  • Included Modules or ‘Mixins’
  • Name Conflicts
  • Alias methods
  • Mix-in With Care!
  • Including Modules From Files
    - DIGGING DEEPER
  • Modules and Classes
  • Pre-Defined Modules
  • Scope Resolution
  • Module Functions
  • Extending Objects

Chapter Thirteen
- FILES AND IO

  • Opening and Closing Files
  • Files and Directories…
  • Copying Files
  • Directory Enquiries
  • A Discursion Into Recursion
  • Sorting By Size
    - DIGGING DEEPER
  • Recursion Made Simple

Chapter Fourteen
- YAML

  • Converting To YAML
  • Nested Sequences
  • Saving YAML Data
  • Omitting Variables On Saving
  • Multiple Documents, One File
  • A YAML Database
  • Adventures in YAML
    - DIGGING DEEPER
  • A Brief Guide To YAML

Chapter Fifteen
- MARSHAL

  • Saving and Loading Data
  • Omitting Variables On Saving
  • Saving Singletons
  • YAML and Singletons
    - DIGGING DEEPER
  • Marshal Version Numbers

Chapter Sixteen
- REGULAR EXPRESSIONS

  • Making Matches
  • Match Groups
  • MatchData
  • Pre and Post Match
  • Greedy Matching
  • String methods
  • File Operations
    - DIGGING DEEPER
  • Regular Expressions

Chapter Seventeen
- THREADS

  • Creating Threads
  • Running Threads
  • The Main Thread
  • Thread Status
  • Ensuring That A Thread Executes
  • Thread Priorities
  • Mutexes
    - DIGGING DEEPER
  • Passing Execution To Other Thread

Chapter Eighteen
- DEBUGGING AND TESTING

  • IRB - Interactive Ruby
  • Debugging
  • Unit Testing
    - DIGGING DEEPER
  • Assertions Available when Unit Testing
  • Line Breaks Are Significant
  • Graphical Debuggers

Chapter Nineteen
- RUBY ON RAILS

  • First Install Rails
  • MVC – Model, View, Controller
  • A First Ruby On Rails Application
  • Create A Rails Application
  • Create A Controller
  • Can’t Find The Database?
  • Anatomy Of A Simple Rails Application
  • Create A View
  • Rails Tags
  • Let’s Make A Blog!
    - DIGGING DEEPER
  • MVC
  • The Rails Folders
  • Other Ruby Frameworks

Chapter Twenty
- DYNAMIC PROGRAMMING

  • Self-Modifying Programs
  • Eval Magic
  • Special Types of Eval
  • Adding Variables and Methods
  • Creating Classes At Runtime
  • Bindings
  • Send
  • Remove Methods
  • Handling Missing Methods
  • Writing Programs At Runtime
    - DIGGING DEEPER
  • Freezing Objects

Appendices
- APPENDIX A: DOCUMENTING RUBY WITH RDOC

- APPENDIX B: INSTALLING MYSQL FOR RUBY ON RAILS

  • Download MySQL
  • Install MySQL
  • Configure MySQL

- APPENDIX C: FURTHER READING

  • Books
  • E-Books

- APPENDIX D: WEB SITES

  • Ruby and Rails Information

- APPENDIX E: RUBY AND RAILS DEVELOPMENT SOFTWARE

  • IDEs/Editors
  • Web Servers
  • Databases

- APPENDIX F: RUBY IMPLEMENTATIONS

- INDEX

Bookmark and Share   Keywords:  ruby

book-of-ruby.zip
© SapphireSteel Software 2010