RVM support, cherry-picked from @jbbarth commit e3a27a0353b2cfe20d42cb7c8625dc92d0a89185