我正在使用 RubyMine IDE,所以这可能是因为我不知道如何使用它!但这是我所拥有的:一个名为 MyFirstModule 的模块,它有一个名为 say_hello 的方法
module MyFirstModule
def say_hello
puts 'Hello'
end
end
还有一个这样写的类:
require 'MyFirstModule'
class ModuleTester
include MyFirstModule
end
mt = ModuleTester.new
mt.say_hello
然后我通过IDE运行程序,这是我得到的错误:
/Users/Jony/.rvm/rubies/ruby-1.9.3-p374/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/Jony/ RubymineProjects/Rubyist/play_one.rb /Users/Jony/.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 -- MyFirstModule (LoadError) from /Users/Jony/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
来自 /Users/ Jony/RubymineProjects/Rubyist/play_one.rb:1:in<top (required)>' from -e:1:in
load' from -e:1:in `'