What is the difference between require_relative and require in Ruby?

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

What is the difference between require_relative and require in Ruby?

7条回答
  •  醉酒成梦
    2020-11-22 11:04

    I just saw the RSpec's code has some comment on require_relative being O(1) constant and require being O(N) linear. So probably the difference is that require_relative is the preferred one than require.

提交回复
热议问题