Compiling Ruby

I would like to know if there is a way to compile Ruby code somehow, and
if so how?

ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2

Wget it.
Extract it.

Run ./configure. Add flags as you need it.

Run make, then make install.

Also make sure you have stuff like libyaml installed.

http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz