With Run before_install or other chunk of user code before the stock installation logic, it would be possible to manually install the necessary dependencies before the Ruby installation.
For now, you can workaround this by ditching the stock installation logic with language: generic
and installing Ruby by hand.