From: Intransition Date: 2010-01-31T04:31:54+09:00 Subject: Re: "require 'rubygems'" In Your Library/App/Tests Is Wrong? On Jan 30, 1:21 pm, Josh Cheek wrote: > I wonder how many people _don't_ use rubygems. What creates more work, > requiring rubygems so that people who don't want it don't have to use it, or > not requiring rubygems so that people who do want it have to keep putting > -rubygems when they load files? You should not have to do that. Just add '-rubygems' to your RUBYOPT environment variable --that's a necessary part of setting up RubyGems for one's system. > Perhaps a compromise? If I am working on some gem that uses mechanize, I > could require it like this: > > def require_gem( gem_name ) >   begin >     require gem_name >   rescue LoadError >     require( begin GEM_MANAGER rescue 'rubygems' end ) >     require gem_name >   end > end You should simply not have to use require 'rubygems' in your code at all.