UPDATE: As pointed out in the comments, readline was still not actually installing. As of this update, you can install Ruby 2.1.2 instead of 2.1.1 without the need to configure readline.
I was trying to install ruby on the newly released Ubuntu 14.04 and I was running into some issues with readline.
The error looked something like
readline.c:1977:26: error: ‘Function’ undeclared (first use in this function) rl_pre_input_hook = (Function *)readline_pre_input_hook; ^
The solution is to configure ruby with our lib_readline.so
## Install ruby
sudo apt-get install openssl libreadline-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison libcurl4-openssl-dev
Grab the source from http://www.ruby-lang.org/en/downloads/
cd && mkdir srcs && cd srcs
tar xzfv ruby-2.1.1.tar.gz
sudo make && sudo make install
NOTE: make sure the ./configure – -with-readline-dir has two dashes. For some reason WP is stripping that.