the12 the12 - 5 months ago 39
Ruby Question

How does load/require/require_relative handle a file with no file extension?

I have been using a tutorial that uses require with a file that does not have a file extension.



require "secondfile"



In my mind, I'm thinking there is potential for conflict (having two files with the same name, but different extensions). So naturally was wondering how Ruby would ultimately handle determining what file extension to use with load/require/require_relative when the file has no file extension?


From the documentation:

Ruby tries adding “.rb”, “.so”, and so on to the name until found.