Intro to Ruby - Getting Started

Overview
In order to get started, there are some resources you should have in hand. Plus we need to configure your environment so that you can begin writing and executing Ruby code. The following will help you get started. However, if you need the full gamut of info, check my Ruby page.
Literature
I recommend reading the following books and in this order:
- Mr. Neighborly’s Humble Little Ruby Book by Jeremy McAnally - Free. This is a great book for those new to the language. It is fast paced, to the point, and will get you up and running quickly.
- Programming Ruby 1.9: The Pragmatic Programmers’ Guide - $25. The defacto book of the Ruby language (a.k.a. The “Pickaxe” book) in some circles. You’ll be glad to have this book by your side even though it might take you a while to read through it all.
API
Every developer needs a set of API bookmarks for those times when you need to look up the obscure, here are mine:
- Ruby Core API
- Ruby Standard API
- API Doc - Provides quick keyword search capabilities as well as community comments for Ruby and Ruby on Rails.
- Got API - An alternative to API Doc but not as easy on the eyes. Depends on your temperament, of course.
…to be honest, I find API Doc to be my favorite source of info when I’m in a pinch. The rest are good backups. Up to you, of course.
News
Whether you are within the walls of a corporation or a lone wolf, here are a few feeds worth adding to your feed reader in order to stay connected with the community:
- Ruby Inside - The inside scoop on Ruby news.
- RubyFlow - A great site for picking up new resources to add to your development repertoire.
- RubyFu - Useful quick news and resource links.
Tools
It takes very little to develop Ruby code. Using a simple text editor like TextEdit (MacOS) or Notepad (Windows) will do just fine for starters. However, you might consider the following tools as better alternatives to simple text editors:
- TextMate - Lightweight, fast, and costs $30. For the MacOS platform only.
- NetBeans - Developed by Sun and free to use. Works on multiple platforms.
- Aptana - Adds Ruby on Rails support to the Eclipse IDE. Visit the software update site to install directly into Eclipse.
I am a MacOS guy, so TextMate is my development tool of choice when writing Ruby code. However, if you are not on the MacOS I would recommend Netbeans as it is less buggy than Eclipse (although I do like the Eclipse UI much better).
Installation
Installation and setup on the various operating systems is a breeze, all of which can be found on the Ruby Download page. That said, here is a quick guide of the major operating systems:
- MacOS - For Tiger/Leopard users, Ruby already exists. Simply launch a terminal window and type
irbon the command line and you can start executing Ruby code. Check out my MacOS Ruby Setup (Basic) post for additional configuration tips. - Linux - Check to see if you have Ruby installed first. Use the following command line:
ruby -v. Otherwise, execute the following command:sudo apt-get install ruby irb rdoc. That’s it. - Windows - Download the one-click installer from Ruby Downloads page as mentioned above. Install and reboot after your are done. I’d suggest installing Ruby Gems and SciTE as well. You might need to download and install the zlib on your path if you experience gzip uncompression problems with Ruby Gems.
Command Line
Now that you have read up on Ruby and configured your environment, execute the following commands from a terminal/command window:
ruby -virbputs "Hello, World!"
The first line tells you what version of Ruby you have installed and confirms that Ruby exists on your system, the second line launches the Interactive Ruby Shell (IRB), and the last line executes your first line of Ruby code - which outputs “Hello, World!” back to the command line. Congratulations, you’ve just written your first Ruby program! Tomorrow, we’ll talk about strings.
Article Series - Intro to Ruby
- Intro to Ruby - Getting Started
- Intro to Ruby - Strings
- Intro to Ruby - Numbers
- Intro to Ruby - Ranges
- Intro to Ruby - Arrays
- Intro to Ruby - Hashes
- Intro to Ruby - Variables and Scopes
- Intro to Ruby - Methods
- Intro to Ruby - Blocks
- Intro to Ruby - Classes
- Intro to Ruby - Modules
- Intro to Ruby - Conditionals
- Intro to Ruby - Loops
- Intro to Ruby - Exceptions
- Intro to Ruby - Testing
- Intro to Ruby - Next Steps
No comments yet.
Leave a comment
You must be logged in to post a comment.
Search
Categories
- Adventures
(105)
- Announcements
(36)
- Business
(19)
- Electronics
(28)
- Employment
(1)
- Epicurean
(10)
- Games
(3)
- Literature
(1)
- Mechanical
(4)
- Meetups
(18)
- Movies
(2)
- Music
(26)
- Photography
(1)
- Services
(29)
- Software
(136)