This is an archived course. Information may be out of date, some links are broken and email addresses have been removed.

02 Lesson 0: Installing, References, and your first homework assignment

= Lesson 0: Installing and Documentation References

== Installing

=== Linux

Any modern Linux distribution has ruby package(s). It might even
already be installed. (To check, try 'ruby --version' in a shell). If
you don't have it, install it with the appropriate package management
system. The exact procedure will vary for your distribution. To
start with, for yum-based systems, try::

# yum install ruby

and for apt-get based systems:

# apt-get install ruby

If you need more help, ask on the list.

In both Fedora and Debian, irb (interactive ruby, which has a better
interactive UI than the plain old ruby command) and ri (documentation
tool) are separate packages (called irb and ri). You'll probably want
to install those as well.

=== Windows

There's an installer for Windows here:

http://rubyinstaller.rubyforge.org/wiki/wiki.pl

=== Mac OS X

Tiger (10.4) comes with Ruby installed. For earlier versions, try
this page:

http://homepage.mac.com/discord/Ruby/

(I found it on a google search and haven't tried it, so if you do, let
us know how it goes.)

== Documentation References

There are lots of places to find documentation for Ruby. Sinc nearly
everything you'd search for is an actual word (including 'ruby'
itself, of course), it can be hard to google for.

If you have the 2nd edition of the book, the API reference that starts
in about the middle of the book is great. With the 1st edition, some
of that will be out of date.

The canonical source for online documentation is:

http://ruby-doc.org/

If you have Firefox/Mozilla, there's a fancy sidebar for ruby-doc:

http://ruby-doc.org/docbar/

If you have the 'ri' commad, you can use that for
documentation for libraries that you have installed. For example:

> ri File.new
-------------------------------------------------------------- File::new
File.new(filename, mode="r") => file
File.new(filename [, mode [, perm]]) => file
------------------------------------------------------------------------
Opens the file named by _filename_ according to _mode_ (default is

[...]

Finally, here is another online ruby book featuring cartoon foxes:

http://www.poignantguide.net/ruby/

Other websites that may be useful include:

RubyForge: http://rubyforge.org
Ruby home page (in English): http://ruby-lang.org/en


== Homework

Please 'turn in' your homework on the courses list, using the [Ruby]
subject tag, and with a subject that has something about 'lesson 0'
and 'homework'. It's not due by a specific time, but I would
recommend starting before the next lesson is posted (Mon Nov 14).

First, introduce yourself. Do you know any other programming
languages? What do you like/not like about them? Why are you
interested in Ruby? What are some things you'd like to learn to do?

Second, find and run any ruby program. It can be something you wrote,
something you downloaded (hint, look on RubyForge), an example you
copied out of a book, something a friend wrote for you, etc.

Finally, look at the code. Find a section of about 5-20 lines of
code, and try to figure out what it does. If you figure it out (or
just have a good guess), explain it to us. If not, show us the code
and we'll try to explain it.

That's it, Lesson 1 (covering Chapters 1-3 of the book, "Getting
Started", "Ruby.new", and "Classes, Objects, and Variables") is next
week, Mon Nov 14. See you on the list!

--
Laurel Fan
http://dreadnought.gorgorg.org