About require

Hi folks,

In Ruby why do we wirte code as require ‘enumerator’, instead of
require ‘Enumerator’ with uppercase? What happens if ‘enumerator’ is not
saved in the default path that Ruby usually looks for?

Thanks,

Li

On Sat, 2006-10-21 at 01:06 +0900, Li Chen wrote:

Hi folks,

In Ruby why do we wirte code as require ‘enumerator’, instead of
require ‘Enumerator’ with uppercase?

Because classes and files don’t have a 1:1 mapping, and filesystems on
some systems have case issues.

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

Then it won’t work unless you alter the path or put it in the right
place.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs