→ do it like rake

22 July 2010

If you must require RubyGems in your Ruby library, do it like Rake:

begin
  require 'rake'
rescue LoadError
  require 'rubygems'
  require 'rake'
end

Everyone wins.