我正在尝试运行这段 Ruby 代码,但出现错误,这似乎是什么问题?
require 'restaurant'
class Guide
def initialize(path=nil)
#locate the restaurant text file at path
Restaurant.filepath=path
if Restaurant.file_exists
puts "Found restaurant file"
#or create a new file
elsif Restaurant.create_file
puts "Created restaurant file"
#exit if create fails
else
puts "\n\nExiting\n\n"
exit!
end
end
end
这是我得到的错误:
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- restaurant (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from guide.rb:1:in `<main>'