So, if you don't have any other version of Ruby installed on the system, just do the following:
sudo apt-get update
sudo apt-get install ruby1.9.1 ruby1.9.1-dev \ rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \ build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev
After Ruby is installed, check the version of the programming language - run in terminal:
If you have Ruby installed already and need to switch to the latest version, take a look at this post that will explain in more details what you need to do: http://lenni.info/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/.