On 11/9/2011 00:23, Kaye Ng wrote:
> Jon Forums wrote in post #1030863:
> n C:\Ruby192\bin ?
>>
>> Hey, you're missing out on one of the best ways to learn Ruby;
>> spelunking Ruby's innards via `irb` or `ripl`.
>>
>> Try something this and see what you discover :)
>>
>> C:\>irb
>> irb(main):001:0>  puts $LOAD_PATH
>> C:/ruby193/lib/ruby/site_ruby/1.9.1
>> C:/ruby193/lib/ruby/site_ruby/1.9.1/i386-msvcrt
>> C:/ruby193/lib/ruby/site_ruby
>> C:/ruby193/lib/ruby/vendor_ruby/1.9.1
>> C:/ruby193/lib/ruby/vendor_ruby/1.9.1/i386-msvcrt
>> C:/ruby193/lib/ruby/vendor_ruby
>> C:/ruby193/lib/ruby/1.9.1
>> C:/ruby193/lib/ruby/1.9.1/i386-mingw32
>> =>  nil
>> irb(main):002:0>
>
> Hi Jon! I am familiar with IRB and 'puts $LOAD_PATH'.  I fail to see
> your point.   I still don't know what file is being required in:
>
> require 'rubygems'
>
> Is it the rubygems.rb in C:\Ruby192\lib\ruby\1.9.1 ?
>
> If it is, then why is that when I cut it and paste it somewhere else
> (e.g. on the Desktop), the program which has the require 'rubygems' code
> would still run?

First of all, the version of Ruby you appear to be using (1.9.2) 
automatically requires in the rubygems file, so you don't need to do it 
yourself in your scripts unless you want to ensure that they continue to 
run on older Ruby versions (1.8.x).

If you would like to see where rubygems.rb lives for your Ruby instance, 
try running the following:

ruby -e "puts $\""

That will print out the list of loaded files, and you should see full 
path to rubygems.rb in there.

-Jeremy