What is the difference between require_relative and require in Ruby?

后端 未结 7 1875
深忆病人
深忆病人 2020-11-22 10:15

What is the difference between require_relative and require in Ruby?

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 10:50

    I want to add that when using Windows you can use require './1.rb' if the script is run local or from a mapped network drive but when run from an UNC \\servername\sharename\folder path you need to use require_relative './1.rb'.

    I don't mingle in the discussion which to use for other reasons.

提交回复
热议问题