[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: about require

Gavin Kistner

10/20/2006 4:17:00 PM

From: Li Chen
> In Ruby why do we wirte code as require 'enumerator', instead of
> require 'Enumerator' with uppercase?

Because you are specifying the name of the file that the Enumerator
class is in, not the class itself.

> What happens if 'enumerator' is not
> saved in the default path that Ruby usually looks for?

Then you get an error:
LoadError: no such file to load -- enumerator

1 Answer

Li Chen

10/20/2006 4:39:00 PM

0


>> In Ruby why do we wirte code as require 'enumerator', instead of
>> require 'Enumerator' with uppercase?
>
> Because you are specifying the name of the file that the Enumerator
> class is in, not the class itself.
>
>> What happens if 'enumerator' is not
>> saved in the default path that Ruby usually looks for?
>
> Then you get an error:
> LoadError: no such file to load -- enumerator

Where is the default path that Ruby looks for? What if I want to ask
Ruby also looks for another path? And in what format,with rb extension?

Thanks,

Li

--
Posted via http://www.ruby-....