Added require 'rubygems' for Ruby < 1.9. Closes #2693.