加载者.rb
puts '> This is the second file.'
加载演示.rb
puts 'This is the first (master) program file.'
load 'loadee.rb'
puts 'And back again to the first file.'
当我运行时"ruby loaddemo.rb"
,这工作正常。这两个文件都在同一个目录中,这就是我运行的目录。
但是,如果我将负载更改为要求,并且有或没有扩展名,我会得到:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load
-- loadee.rb (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from loaddemo.rb:2:in `<main>'
我的问题当然是,为什么不需要在这种情况下工作?应该是吧?load 和 require 使用不同的路径吗?
红宝石版本 1.9.2