I encountered a problem earlier today when I tried to install ruby 2.2 on my Ubuntu machine. I tried the default installation guides at https://www.ruby-lang.org/en/documentation/installation/, but as of writing, the ruby-full package provides Ruby 1.9.3, which is an old stable release, on Debian and Ubuntu.
There's a lot of ways to install latest stable ruby version on your Linux machine. In my opinion, the easiest one is to use RVM (Ruby Version Manager). Open up your terminal and enter the following lines:
Install RVM and Ruby stable
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \curl -sSL https://get.rvm.io | bash -s stable --ruby rvm get stable
Check ruby version
ruby -v > ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
gem install compass