2014-04-29 43 views
0

需要無法加載文件要求不能加載這樣的文件,而寫一示例代碼

下面是代碼

$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

+0

什麼是你的問題? – sawa

+0

不能通過require'ss'調用ss.rb – aashish

+0

您的問題是什麼? – sawa

回答

相關問題