Getting started in Ruby
Although this is a Java blog, I am going to get started write about Ruby as well.
Why? Because I am studying Ruby and I am very impressed with this language. Also, with Ruby running on JVM (JRuby) I see a big opportunity to use both languages in a great environment.
In the past, I have studied Perl (where I have used at IBM) and also Python. But Ruby has been the most fantastic script language I have ever seen.
For this first topic, I am going to show how to install Ruby on Linux Ubuntu 7.10, as well as see its documentation through the shell.
Installing Ruby on Ubuntu 7.10
Fortunately this is an easy process. Simply type the following command on the linux shell:
sudo apt-get install ruby rdoc ri irb libyaml-ruby libzlib-ruby ri ruby1.8-dev
The command above is going to install Ruby, IRB tool, some libs and its documentation.
Next, we are going to install the gems. Follow the following commands:
wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz tar zxvf rubygems-1.0.1.tgz cd rubygems-1.0.1 sudo ruby setup.rb sudo gem update --system
- Download gem source code
- Unzip the file
- Get into rubygems directory
- Install gem
- Update gem
Simple, isn’t it?
After that Ruby should be installed. To make a test, type irb in the shell. After, type puts “Hello World”. You are going to see a screen like that:

As you can see, irb is a tool where you are able to write Ruby code. It is useful when you are testing and/or learning Ruby.
Hello Ruby World
The example above is a “Hello World” using IRB. If you want to create a concrete file, simply create a file with .rb extension and insert the same code puts “Hello World”.
After that, on the shell, type ruby <file name>.rb. Done!! you have created a concrete file and ran it.

Documentation
Documentation is our friend in any language. In Ruby, you can read the API documentation through ri tool.
If you want to read the documentation about any class, for instance an Array, simply type on shell:
ri Array
A documentation about Array will appear on your screen.
If you want to read the documentation about a certain method, for instance, a each method from array, type on the shell:
ri Array.each
This is a useful tool and you should use it as much as you can.
Well guys, I hope this simple topic be useful for anyone. Next, I am going to show you how to improve the VIM editor to create/edit ruby files.
See you

Brazilian guy, IT Specialist, Linux and Mac User. Work with Java/JEE and IBM Products, such as: WebSphere and DB2. Like studying Ruby, Android and IOS. Also, I like playing tennis, however I am not good enough. Write a post in this blog once a year. Follow me on twitter if you understand portuguese: @jairrillo.
Or you can use Netbeans and have JRuby out of the box.
Also use the latest Gem available, they just released 1.0 and now 1.0.1.
Hey Piku
Thank you very much for your comment.
I just updated my gems on my local computer and also I’ve updated the blog.