From: Jeremy Hinegardner Date: 2007-05-23T04:16:37+09:00 Subject: behavior of -rsomegem differs from require 'somegem' I just encountered something today and I'm not sure if this should be the expected behaviour. Most likely I'm doing something odd here. I believe this only affects items require'd as gems. > ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1] > cat j.rb require 'rubygems' require 'fastercsv' puts $:.sort.join("\n") > ruby j.rb . /opt/local/lib/ruby/1.8 /opt/local/lib/ruby/1.8/i686-darwin8.9.1 /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/bin /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib /opt/local/lib/ruby/site_ruby /opt/local/lib/ruby/site_ruby/1.8 /opt/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1 /opt/local/lib/ruby/vendor_ruby /opt/local/lib/ruby/vendor_ruby/1.8 /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin8.9.1 Okay, that is all well and good, but how about if we put those require's on the command line and use -e. > ruby -rubygems -rfastercsv -e 'puts $:.sort.join("\n")' ruby: no such file to load -- fastercsv (LoadError) Hmm... odd (to me). Lets try something else > ruby -rubygems -e 'require "fastercsv"' -e 'puts $:.sort.join("\n")' . /opt/local/lib/ruby/1.8 /opt/local/lib/ruby/1.8/i686-darwin8.9.1 /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/bin /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib /opt/local/lib/ruby/site_ruby /opt/local/lib/ruby/site_ruby/1.8 /opt/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1 /opt/local/lib/ruby/vendor_ruby /opt/local/lib/ruby/vendor_ruby/1.8 /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin8.9.1 Is this the expected behaviour that -rsomegem behaves differently than 'require "somegem"'. Is the handling of -r different than 'require' enjoy, -jeremy -- ======================================================================== Jeremy Hinegardner jeremy@hinegardner.org