我是 Ruby 的绝对初学者。我创建了一个小的 ruby 文件,当我运行命令时它运行良好ruby "methods.rb"
。这意味着我在正确的目录中。
但是当我启动 irb 并运行命令require "methods.rb"
时,我得到以下响应:
LoadError: cannot load such file -- methods.rb
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:53:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:53:in `require'
from (irb):1
from /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `<main>'