Beginning Ruby
If you're just getting to know Ruby, these articles will tell you what you need to know to get started. From a basic explanation of the programming language to comparison to other programming languages to descriptions of descriptions of Ruby's basic features, you'll get to know Ruby.
- Comparisons: Ruby Vs. The World (5)
- Control Structures (12)
- Enumerable: Working with Collections (2)
- Files and Directories (4)
- Install Ruby
- New in Ruby 1.9.x (13)
- Object Oriented Programming (11)
- Ruby's Basic Features (9)
- Strings (15)
- Tutorials on the Web (2)
- Variables (11)
What is Ruby?
What is Ruby really? Whether you're new to Ruby or new to programming, this article will explain what Ruby is as buzzword-free as possible.
Using PLEAC To Get Up To Speed Quickly
PLEAC is most useful when you think to yourself "How do I do XYZ in Ruby again?" You might just be forgetting the exact syntax of a language construct or the name of a method, and PLEAC will bring you up to speed quickly.
Mixin Modules
Mixins are one of Ruby's defining features, but often one of the most difficult to understand for those new to Ruby. They're not difficult to understand, but they're not something most programmers have encountered before as most languages don't have mixins.
How Do You Comment Your Ruby Code?
Commenting Ruby code is a good way to leave notes and annotations for other programmers, but it's not always easy to decipher. How do you comment your code?
Capturing the Return Value of an External Program
Ruby makes it easy to run external programs and capture their output. Using the built-in "backtick" operator is as easy as running these programs from the command line. However, it's not obvious how to capture the return value of these programs.
Practical Ruby
From installation to using RubyGems to simple tasks and tutorials, this page will give Ruby on Rails programmers a few ways to begin using their programming chops.
Quick Tip: Last Result in IRB
There's a really quick way to get the result of the last expression evaluated in IRB.
5 Must Know Features of Ruby
If you're going to program in Ruby, there are some basic features you absolutely must know. Here are the Top 5.
A Beginner's Guide to Ruby
What type of language is the Ruby programming language?
Block Parameters and Yielding
Block parameters allow you to pass small anonymous methods to a method call. It's so common an idiom in Ruby that it's replaced "for" loops as preferred idiom for iteration. When was the last time you saw a for keyword in Ruby? You rarely see it, Rubyists use the each method, possibly on a Range object if a series of numbers is needed.
The Ruby Homepage
Homepage of the Ruby programming language. Download Ruby, view documentation and stay up to date with Ruby developments.
Ruby-Doc.org
Archive of Ruby documentation from across the world wide web.
Programming Ruby
First edition of the book "Programming Ruby: The Pragmatic Programmer's Guide" for free online.
Ruby Wikipedia Entry
General information about Ruby and the history of Ruby.
JRuby
An alternative implementation or Ruby written in Java and officially supported by Sun Microsystems.
Interacting with External Programs
You’ve learned how to launch external programs using both system or backticks and using the exec method. These are both fine, but only on one condition: the program launched doesn’t require any input.
The Zen of Learning Ruby
Learning Ruby isn't often thought of as a Zen exercise, but that's exactly how the guys at EdgeCase saw it. Thus RubyKoans was born.
Quick Tip: Install Gems Faster
Some larger projects, especially Ruby on Rails, come with quite a bit of documentation. This is good, documentation is good, but the code that processes this documentation (RDoc) into HTML and ri format is not exactly speedy. On slower computers, or with larger projects, the time this takes becomes and annoyance.
The Magic of Symbol#to_proc
How do you convert a Symbol to a Proc? What does it even mean to do that? The Symbol#to_proc method is a shortcut or convenience method used in a variety of places in methods that accept blocks.
Command-line Arguments
Use command-line arguments to pass parameters to your Ruby scripts from the command line.
Comments
Use comments to annotate your Ruby code.
Aliasing
Aliasing is a powerful Ruby feature that allows more than one method to be referred to by multiple names. This can be used to give a programmer more expressive options or to create copies of a method, allowing you to change the behavior of a class.
Using the 'require' Method
The 'require' method is the reusable code mechanism in Ruby. It allows you to import other source files into your programs.
Exceptions
Exceptions are used to handle things the unexpected things that might go wrong with your Ruby code. This article addresses what Exceptions are and how they can be used.
How to Install Ruby
How to install the Ruby interpreter on Windows, Linux and OS X.
Using the Command Line
How to use the command line interface on Windows, Linux and OS X to run Ruby scripts and use the interactive Ruby program.
Using the Command Line
How to use the command line interface on Windows, Linux and OS X to run Ruby scripts and use the interactive Ruby program.
Building Hashes
A hash is an associative array. Instead of using numerical indexes, any object (but typically symbols) can be used. They can be both a fast way to retrieve an object based on a key, and a convenient key/value store. There's no doubt, hashes are one of the most used types in Ruby.
Why JRuby?
As a Rubyist you probably know and love the official Ruby implementation. It's very stable and capable, so why should you use JRuby?
Getting Information About a File in Ruby Using File::Stat
How large is a file? Is it a symbolic link? The File::Stat class can tell you information about a file.
Worked Example: Number Guessing Game
A number guessing game is written an examined. This is perhaps the simplest game that can be written, and is a classic newbie program for any programming language.
Worked Example: Tabular Data
There are two main data structures in Ruby: the Array and the Hash. However, it's also quite easy to make more complex data structures such as two dimensional arrays.
