Ruby Programming

From Wikibooks, open books for an open world
(Redirected from Ruby programming language)
Jump to: navigation, search
Ruby was named after the precious gem.

Ruby is an interpreted, object-oriented programming language. Its creator, Yukihiro Matsumoto, a.k.a “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[edit]

Getting started[edit]

Overview
Installing Ruby
Ruby editors
Notation conventions
Interactive Ruby
Mailing List FAQ

Basic Ruby[edit]

Hello world
Strings
Alternate quotes
Here documents
ASCII
Encoding
Introduction to objects
Ruby basics
Data types — numbers, strings, hashes and arrays
Writing methods
Classes and objects
Exceptions

Ruby Semantic reference[edit]

See also some rdoc documentation on the various keywords.

Built in Classes[edit]

This is a list of classes that are available to you by default in Ruby. They are pre-defined in “core.”

Available Standard Library Modules[edit]

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[edit]

GUI Libraries[edit]

Here is info on some specifically:

  • Tk
  • GTK2 Notes on the GTK/Gnome bindings.
  • Qt4

Intermediate Ruby[edit]

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[edit]

Documentation[edit]

Core Docs[edit]

  • ruby-doc.org various ruby documentations and tutorials, as well as information on how to update ruby's core docs should you so desire.
  • webri ruby core api as a webri

gem docs[edit]

Learning Ruby[edit]

Books[edit]

Print[edit]
Online[edit]

Quick References[edit]