Given that there is require_relative
, which accepts relative as well as absolute paths, is there any reason to particularly use require
, which accepts only absolute paths? Can all require
be replaced by require_relative
?
Edit
Sergio Tulentsev noticed me that require_relative
cannot be used for gems. Why is it designed so? What problem would arise if require_relative
were merely a superset of require
and require
be deprecated? Or, is it just because require_relative
appeared later than the incorporation of gems into the Ruby core system, and the author of require_relative
did not do modification to the code around the gems system?