From: Rick DeNatale Date: 2007-05-24T02:17:50+09:00 Subject: Re: require_gem vs. gem On 5/23/07, Dennis Crissman wrote: > Fran�ois Beausoleil wrote: > > The #gem call activates the gem, and the require is the regular > > require to load a library. > > What is the difference between an "active" gem and a gem that has been > "loaded". "active" gem is informal. What the gem directive really does is to set up the load path before the require. Normally it's not needed unless you want to specify a version of the gem other than the default. $ qri gem ------------------------------------------------------------- Kernel#gem gem(gem_name, *version_requirements) ------------------------------------------------------------------------ Adds a Ruby Gem to the $LOAD_PATH. Before a Gem is loaded, its required Gems are loaded. If the version information is omitted, the highest version Gem of the supplied name is loaded. If a Gem is not found that meets the version requirement and/or a required Gem is not found, a Gem::LoadError is raised. More information on version requirements can be found in the Gem::Version documentation. The gem directive should be executed before any require statements (otherwise rubygems might select a conflicting library version). You can define the environment variable GEM_SKIP as a way to not load specified gems. you might do this to test out changes that haven't been intsalled yet. Example: GEM_SKIP=libA:libB ruby-I../libA -I../libB ./mycode.rb gem: [String or Gem::Dependency] The gem name or dependency instance. version_requirement: [default=">= 0.0.0"] The version requirement. return: [Boolean] true if the Gem is loaded, otherwise false. raises: [Gem::LoadError] if Gem cannot be found, is listed in GEM_SKIP, or version requirement not met. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/