$ rvm install ruby-1.8.7-p249
Installing Ruby from source to: /home/sayuj/.rvm/rubies/ruby-1.8.7-p249, this may take a while depending on your cpu(s)...
ruby-1.8.7-
From here : http://ahmy.yulrizka.com/2011/10/ruby-ree-1-8-7-openssl-error/
rvm pkg install openssl
And from one of the answers here: https://stackoverflow.com/a/8544958/178975
rvm install ruby-1.8.7 --with-openssl-dir=/usr
where rvm_dir could be $HOME/.rvm or /usr/local/rvm or wherever you have installed rvm