Karl von Laudermann wrote:
> I don't understand this; if somefile.rb is in the same directory as
> the file that's requiring it, then why do you need the full path? Why
> doesn't

Sorry; I forgot to specify that the context I'm discussing is irb. For 
hacking at scripts or examples, a lot of times I'll make some variables 
global and load the file into irb, then mess with the globals to figure 
out how to do whatever I want.

Let's say you have somefile.rb, which can contain anything. Then you 
have the file someprog.rb, which contains:
------------------
require 'somefile.rb'
------------------

In irb, if you type:
irb(main):001:0> load 'c:/whatever/someprog.rb'

The prompt will blow up with a "no such file to load" error.

However, if your someprog.rb file contains:
------------------
$: << File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
require 'somefile.rb'
------------------

It will successfully load.
-- 
Posted via http://www.ruby-forum.com/.