Zhao Yi wrote:

> In a big ruby project, how to prevent requiring a file multiple times?
> Like the #ifdef in C.

require() already prevents multiple includes. load() forces an unquestioned input.

If two modules require the same module...

   require 'foo'

...and if both modules specify the same path to foo (or no path), then the file 
only imports once.

However, if you require some elaborate path, and if another module requires a 
different path to the same file, Ruby does not care if the file is the same - it 
will load() and execute the same source twice.

-- 
   Phlip