需要無法加載文件要求不能加載這樣的文件,而寫一示例代碼
下面是代碼
$LOAD_PATH.unshift File.dirname('./test/ss.rb')
require "test/version"
require "test/ss"
輸出:
ruby test_require.rb
/usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- ss (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from test_require.rb:2:in `<main>'
如何使需要' ss'work
什麼是你的問題? – sawa
不能通過require'ss'調用ss.rb – aashish
您的問題是什麼? – sawa