Ruby 中的 require_relative
和 require
有什么区别?
最佳答案
看看docs :
require_relative
complements the builtin methodrequire
by allowing you to load a file that is relative to the file containing therequire_relative
statement.For example, if you have unit test classes in the "test" directory, and data for them under the test "test/data" directory, then you might use a line like this in a test case:
require_relative "data/customer_data_1"
关于ruby - Ruby 中的 require_relative 和 require 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3672586/