411 REFERENCE · Wikibooks
Ruby Programming
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
thumb|150px|Ruby was named after the precious gem.
Ruby is an interpreted, object-oriented programming language. Its creator, Yukihiro Matsumoto, aka “Matz”, released it to the public in 1995. Its history is covered here. Its many features are listed here.
The book is currently broken down into several sections and is intended to be read sequentially. Getting started will show how to install and get started with Ruby in your environment. Basic Ruby demonstrates the main features of the language syntax. The Ruby language section is organized like a reference to the language.
Available modules covers some of the standard library. Intermediate Ruby covers a selection of slightly more advanced topics. Each section is designed to be self contained.
Table of Contents
Ruby_Programming
Getting started
/Overview/ 75%
/Installing Ruby/ 50%
/Ruby editors/ 25%
/Notation conventions/ 75%
/Interactive Ruby/ 50%
/Mailing List FAQ/ 25%
Basic Ruby
/Hello world/ 100%
/Strings/ 75%
/Alternate quotes/ 50%
/Here documents/ 75%
/ASCII/ 50%
/Encoding/ 50%
/Introduction to objects/ 75%
/Ruby basics/ 75%
/Data types/ — numbers, strings, hashes and arrays 50%
/Writing methods/ 75%
/Classes and objects/ 50%
/Exceptions/ 0%
Ruby Semantic reference
/Syntax/
Lexicology
Identifiers
Comments
Embedded Documentation
Reserved Words
Expressions
Variables and Constants
Local Variables
Instance Variables
Class Variables
Global Variables
Constants
Pseudo Variables
Pre-defined Variables
Literals
Numerics
Strings
Interpolation
Backslash Notation
The % Notation
Command Expansion
Regular Expressions
Arrays
Hashes
Ranges
Symbols
Operators
Assignment
Self Assignment
Multiple Assignment
Conditional Assignment
Scope
and
or
not
Control Structures
Conditional Branches
if
if modifier
unless
unless modifier
case
Loops
while
while modifier
until
until modifier
for
for ... in
break
redo
next
retry
Exception Handling
raise
begin
rescue modifier
Miscellanea
return
returning
Methods
super
Iterators
yield
Classes
Class Definition
Instance Variables
Class Variables
Class Methods
Instantiation
Declaring Visibility
Private
Public
Protected
Instance Variables
Inheritance
Mixing in Modules
Ruby Class Meta-Model
Ruby Hooks add the ability to know when new methods are defined et al.
See also some rdoc documentation on the various keywords.
Built in Classes
This is a list of classes that are available to you by default in Ruby. They are pre-defined in “core.”
Built-in Functions
Predefined Variables (globals) 25%
Predefined Classes
Object
Array
Class
Comparable
Encoding
Enumerable
Enumerable::Enumerator
Enumerator
Exception
FalseClass
Fiber
IO
File
File::Stat
GC
GC::Profiler
Marshal
Method
Math
Module
Class
NilClass
Numeric
Integer
Bignum
Fixnum
Float
Range
Regexp
RubyVM
String
Struct
Struct::Tms
Symbol
Time
Thread
TrueClass
Available Standard Library Modules
These are parts of Ruby that you have available (in the standard library, or via installation as a gem).
To use them you typically have to require some filename, for example require 'tracer' would make accessible to you the Tracer class.
You can see a list of basically all the (std lib ruby) modules available in the ruby source and lib readme. There are a several more modules available in the std lib, which are C based extensions. You can see their list here.
BigDecimal gives you a way to have arbitrary precision Decimal style numbers. Never succumb to rounding errors again!
Debugger gives you a way to step through debug your Ruby code.
Distributed Ruby (DRb) gives you a way to make remote procedure calls against objects in a different VM.
mkmf is a utility used to generate makefiles for ruby extensions.
Mutex gives you a way to control thread concurrency.
Net::HTTP gives you a way to download web pages.
Open3 gives you a way to run a sub-process and have easy access to its I/O.
OpenSSL is a wrapper to the OpenSSL (C) library, giving you access to secure socket connections.
Pathname gives you an easy way to manipulate filenames and create/remove files.
Profiler gives you a way to profile what is taking up the most time in your code.
OpenURI gives you a way to download files using ruby.
REXML is a way to parse XML in pure Ruby.
Ripper gives you a way to parse pure Ruby code into an AST.
Socket gives you access to Network connectivity.
Tracer gives you a way to see which lines of your code are being executed and in what order.
Win32::Registry gives you a way to query and edit the windows registry.
Win32API gives you a way to call into specific windows core methods easily.
WIN32OLE gives you a way to use Windows OLE.
Other Libraries
/Database Interface Modules/
GUI Libraries
/GUI Toolkit Modules/ gives a run down of various options for ruby GUI programming.
Here is info on some specifically:
Tk
GTK2 Notes on the GTK/Gnome bindings.
Qt4
Intermediate Ruby
Here are some more in depth tutorials of certain aspects of Ruby.
/Unit testing/
/RubyDoc/
/Rake/
/RubyGems/
/Running Multiple Processes/
Using Network Sockets
Building /C Extensions/
/Rails/
/Embedding Ruby/ within a separate C program
External links
Ruby Programming Language
Ruby homepage
Access to various Ruby mailing lists
Various open-source Ruby projects
Documentation
Core Docs
Ruby Documentation Homepage - various ruby documentations and tutorials.
gem docs
Ruby Toolbox - Find actively maintained & popular open source software libraries for the Ruby programming language
Learning Ruby
Ruby in Twenty Minutes - A small Ruby tutorial
CK-12 - Online Ruby tutorials & practice exercises
Learning Ruby A free tool to find and learn Ruby concepts using flash cards.
Books
Print
The Ruby Programming Language by David Flanagan, Yukihiro Matsumoto aka “Matz,” the creator of Ruby. Also covers 1.9
Programming Ruby 1.9 & 2.0 (aka “Pickaxe”) by Dave Thomas, with Chad Fowler and Andy Hunt — this 2013 version covers Ruby 1.9 and 2.0
Programming Ruby 3.2 by Noel Rappin, with Dave Thomas
Ruby by Example
Online
Programming Ruby (a.k.a. “Pickaxe”) 1st edition online version
Why’s (Poignant) Guide To Ruby
Humble Little Ruby Book
Quick References
Ruby Quick Reference (some of more obscure expressions are explained)
Ruby Cheat Sheets (a list of some different Ruby cheat sheets)
Ruby programming language
R
50%
__NOTOC__
de:Ruby-Programmierung
es:Programación en Ruby
eo:Lernolibro pri Rubeno
fr:Programmation Ruby
nl:Programmeren in Ruby
ja:Ruby
pl:Ruby
ru:Ruby
zh:Ruby Programming