The best way I have found to do this is to manually add the files of the gem to the distributed cache.
Here is an example of using the browser Ruby gem:
I download and unzip browser-master.zip
from GitHub. Then I add the entire unzipped folder to the distributed cache:
ADD FILE /home/user/browser-master
In the Ruby script that I am using in Hive, I have to tell Ruby where to find the needed files from the gem:
$.push File.expand_path("../browser-master/lib", __FILE__)
require "browser"