From: Eric Hodel Date: 2009-06-05T06:55:59+09:00 Subject: Re: why is require 'rubygems' sometimes needed? On Jun 4, 2009, at 14:20, Markus Fischer wrote: > Justin Collins wrote: >> Just as a note (as your question has already been answered), >> requiring >> rubygems is no longer needed in Ruby 1.9. > > How so? I.e., what has been changed that the libraries are > automatically > found? RubyGems is built-in. > Because currently, with 1.8.7, I think I had some troubles getting my > code portable. require 'rubygems' returns false in 1.9, indicating that RubyGems is already loaded. If you want code that runs on both, keep require 'rubygems' around. > On my home machine, I've installed rubyzip through gem and thus I > required rubygems. On another machine, rubyzip was installed with a > distribution specific mechanism and there were no rubygems at all > installed. > > How would I tackle this problem? Would I need rescue the rubygem > require > statement? Are there elegant solutions for this? Since you probably needed other software that came from RubyGems, there's no reason to rescue the require on RubyGems.