1
我想包括一个Ruby模块。在Ruby中包含模块
在文件helper.rb,我有这样的文字
module Helper
...
end
在文件test.rb,我有这样的文字:
....
require 'helper'
...
这些文件上的同一水平目录但我不断收到此错误:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- helper (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from test.rb:4:in `<main>'
我也曾尝试
include Helper
在test.rb和得到这个错误:
test.rb:4:in `<main>': uninitialized constant Object::Helper (NameError)
我在做什么错?