Before we begin, here's a list of the Ruby stuff I have installed on Ubuntu.
This is a quick'n'dirty Ruby tutorial, designed to get you up to speed with Ruby as quickly as possible.
These slides are designed to be worked through, you should be running irb or a command-line version of Ruby so that you can try out the code as you learn about it (and as we discuss it in the lab). These notes supplement the Try Ruby tutorial (which we will work through during class).
No one ever learned a new programming language by reading alone - you have to write some code in order to make sure you understand the behaviours being presented.
This material assumes that you have someone close by who knows Ruby and is actively working through this with you (i.e., this tutorial favours the classroom or laboratory setting). If this is not possible, you may want to apply for a mentor through the RubyMentor project, at the RubyMentor Wiki, where volunteers offer to guide newbies through the process of learning Ruby one-on-one (by email).
Learn Ruby 1 - Numbers and stuff. Some simple Ruby that manipulates number objects, strings, etc..
Learn Ruby 2 - Arrays and Lists, starting to work with Ruby data structures.
Learn Ruby 3 - Hashes, the Ruby associative array.
Practice: Try some practice exercises after working through Learn Ruby 1, 2 and 3. (Solutions will be covered in class).
By the way, now would be a good time to look-up the syntax for Ruby's if statement. Oh, look! I've done it for you.
Learn Ruby 4 - Code Blocks and those wonderful Ruby iterators.
Learn Ruby 5 - Files.
The source code to the regex.rb program.
Practice: Time for some more practice exercises for you to try with your ever expanding Ruby skills. (Solutions will be covered in class).
Learn Ruby 7 - Methods.
Learn Ruby 8 - Ruby Libraries - don't reinvent the wheel!
Learn Ruby 9 - Classes - if you must invent wheels, do it this way!
Learn Ruby 10 - Ruby's In-Built Classes.
Practice: Time to play with methods, modules and classes thanks to some more practice exercises. (Solutions will be covered in class).
Learn Ruby 11 - A grabbag of other Ruby stuff, all of it useful, some of it very cool.
Learn Ruby 12 - More grabbag stuff, some other nice things to know (and one thing to definitely forget about).
Learn Ruby 13 - Even more grabbag stuff, relating to exception handling.
Practice: The final practice exercises, playing with boxes and exception handling. (Solutions will be covered in class).
Learn Ruby 14 - The last of the grabbag stuff (I promise). Learning about Ruby's setup.
OK ... we are now done with learning Ruby as quickly as possible. Now that you know how to write Ruby code, be sure to work through Chapter 12 of The PickAxe to learn how to use an in-built technology to unit test your code. (You are testing the code you write, aren't you?!?!?).
No more practicing - time to use Ruby for real!
If you are interested in adapting these slides, check out the source page.
Return to the tutorials page.